Lou Logan
Forum Replies Created
-
You can connect filters together with commas to create a filterchain. You can connect multiple filterchains together with semicolons.
-vf scale,drawtext -
Does this also occur with the native FFmpeg AAC encoder? Also, libvo_aacenc is often considered the worst AAC encoder supported by FFmpeg, but you don’t always have much choice unless you can compile.
Replace “-acodec libvo_aacenc” with “-acodec aac -strict experimental” Also, you can remove “-aprofile aac_low”. I don’t think either of these encoders can support anything else anyway but I may be incorrect.
-
Lou Logan
August 20, 2014 at 7:41 pm in reply to: FFMPEG: Add black frames at start and end of video[Thomas Demirian] “But now I have to mix these two together so that its 10 seconds of text at the start. Then the video. And lastly 30 seconds of black.”
You can connect a sequence of filters with commas. This is called a filterchain. You can connect a sequence of filterchains with semicolons, and the whole thing is called a filtergraph:
ffmpeg -i Input.mov -f lavfi -i "color=c=black:s=720x576:r=25:sar=1050/720" -filter_complex \
"[0:v] setpts=PTS-STARTPTS [main]; \
[1:v] trim=end=10,drawtext=fontfile=/Library/Fonts/Georgia.ttf:text='Text to write':fontsize=30:fontcolor=white:x=(w-text_w)/2:y=(h-text_h-line_h)/2,setpts=PTS-STARTPTS [pre]; \
[1:v] trim=end=30,setpts=PTS-STARTPTS [post]; \
[pre][main][post] concat=n=3:v=1:a=0 [out]" \
-map "[out]" -vcodec mpeg2video -maxrate 30000k -b:v 30000k Output.mpg -
Sorry, but setsar should be sar (I edited the example). I was unable to test the example at the time I wrote it, and unfortunately I’m also unable to test now.
-
- Use “-filter_complex” instead of “-vf” when filtering multiple inputs and/or multiple outputs.
- Make the blank video have the same parameters as the main video.
- Since concat required that all input timestamps start at zero it is usually a good idea to add the setpts filter to do so.
- If you’re declaring a video bitrate, use “-b:v” instead of “-b”, but since you’re only outputting video in this case it does not really matter.
Explicitly list the values for “n”, “v”, and “a” in concat instead of relying on the defaults.
ffmpeg -i input -f lavfi -i "color=c=black:s=720x576:r=25:sar=1023/788" -filter_complex \
"[0:v] setpts=PTS-STARTPTS [main]; \
[1:v] trim=end=10,setpts=PTS-STARTPTS [pre]; \
[1:v] trim=end=30,setpts=PTS-STARTPTS [post]; \
[pre][main][post] concat=n=3:v=1:a=0 [out]" \
-map "[out]" -vcodec mpeg2video -maxrate 30000k -b:v 30000k output.mpg -
Please include the complete ffmpeg console output that results from the command that does not work as expected.
-
You can use the drawtext, setpts, crop, and overlay video filters:
ffmpeg -i input0 -i input1 -filter_complex \
"[0:v]drawtext=fontfile=/usr/share/fonts/TTF/Vera.ttf:fontsize=90:text='left':x=(w-text_w)/4:y=h-text_h-10,setpts=PTS-STARTPTS[l]; \
[1:v]crop=iw/2:ih:ow:0,drawtext=fontfile=/usr/share/fonts/TTF/Vera.ttf:fontsize=90:text='right':x=(w-text_w)/2:y=h-text_h-10,setpts=PTS-STARTPTS[r]; \
[l][r]overlay=W/2[out]" \
-map "[out]" -codec:v prores output.mov- The example above uses two obviously different video contents just to show the left and right sides.
- setpts is used because frames are taken from each input video in timestamp order, and if their initial timestamps differ, it is a good idea to pass the two inputs through a setpts=PTS-STARTPTS filter to have them begin in the same zero timestamp.
- This will work for any two same sized inputs. For size, all you will have to adjust is fontsize.
-
Thanks for asking, but with or without my name is fine with me. Whatever you prefer.
-
Interesting concept and thanks for sharing.
What were the limitations of the subtitles filter?
-
You may be able to use the overlay video filter with “picture” based subtitles: How to burn subtitles into the video: picture based subtitles
