Skip to content

Instantly share code, notes, and snippets.

@visionik
Created April 2, 2019 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save visionik/57c3557391b73c4bdb72d1f7ab5454c6 to your computer and use it in GitHub Desktop.
Save visionik/57c3557391b73c4bdb72d1f7ab5454c6 to your computer and use it in GitHub Desktop.
# ---------------------------------------------------------------
# Sighthound.io - binary video example
# ---------------------------------------------------------------
# run as:
# sio run binary.yaml IN=video.mp4 OUT=output-video.mp4 TH=4
nodes:
# Read the audio and video packets from the input file.
- type: "PacketFileReader"
outputs:
audioPackets: "audioPackets"
videoPackets: "videoPackets"
options:
inputFile: "${IN}"
# Decode the video packets
- type: "VideoPacketDecoder"
inputs:
packet: "videoPackets"
outputs:
RGBFrame: "RGBFrames"
timestamp: "timestamp"
metadata: "videoMetadata"
# Convert to binary and back.
- type: "BinaryFrame"
input: "RGBFrames"
output: "binaryFrames"
options:
binaryThreshold: "${TH}"
# Encode the output video.
- type: "VideoPacketEncoder"
inputs:
frame: "binaryFrames"
timestamp: "timestamp"
metadata: "videoMetadata"
outputs:
packets: "outputPackets"
# Write the two streams (video and audio) into the output file.
- type: "PacketFileWriter"
inputs:
videoPackets: "outputPackets"
audioPackets: "audioPackets"
options:
outputFile: "${OUT}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment