Application Note Xinye
Application Note Xinye
Xinye Ji
General Overview of a base script:
In order to change certain settings while recording a live stream with FFMPEG, this
base shell script must be changed. The description of each option is as follows:
Line 17: ffmpeg telling the terminal that ffmpeg is being used.
Lines 18-21: Defining the input feeds and the settings of each feed below.
Video4linux2 is an open source package that allows the machine to
have a live feed of the webcam.
-r 10 refers to the frame rate (in frames per second)
-vcodec refers to the video codec that the stream is encoded in
-i refers to the input source.
Lines 22-31: Complex Filters This allows the user to add either color filters or
overlays.
filter_complex: the call to implement filters, this is formatted and
constructed in the quoted text (highlighted yellow)
Line 23: This refers to the base resolution of the whole video.
[base] can be any name.
Lines 24-27: Instantiating the input feeds
o [n:v] : The numbering of the inputs, in this case 0-3
o setpts : sets the time point. In this case, PTS-STARTPTS
refers to 0, ensuring that all video streams are
synchronized.
o Scale = the individual resolution of the respective feed.
o The last part refers to the name of this input. It can be
labeled whatever is needed. In this case, it labels the four
corners.
Lines 28-31: Calls the base layer and immediately stacks the input
feeds in between temporary layers.
o Overlay=shortest=1 enables the video to end as soon as the
shortest video feed ends.
o The X and Y calls simply refer to the upper left corner of
each feed. If x = 320 and y = 240, that means that the upper
left corner of a video feed is located at 320 by 240.
Line 32: Settings for the output video
-q:v refers to the video quality. This number can range between
1-32; one (1) being the highest quality, thirty-two (32) being the
lowest quality.
o The higher the quality, the larger the file size.
-y This enables the script to overwrite a file.
-t Sets the time in seconds. Additionally, 00:00:00.00 can also be
inputted.
temp.mp4 The output file name, this can be named everything.
While this isnt the most efficient method, it serves the purposes of the tutorial well.
Step 3: As this script stands, this output will not be positioned tightly, there will be
odd black space between the feeds, as such we need to change the x and y
coordinates of each feed.