[FFmpeg-user] Clipping inputs -t position with concat video filter
chrisjohannesen at gmail.com
Wed Feb 6 19:35:17 EET 2019
On Wed, Feb 6, 2019 at 12:44 AM Gyan <ffmpeg at gyani.pro> wrote:
> >> ffmpeg -y -ss 86.086 -t 4.004 -i countdownclock_720p2398_21min.mp4 -ss
> > 1257.256 -t 4.004 -i countdownclock_720p2398_21min.mp4 -filter_complex
> > "[0:v:0][1:v:0]concat=n=2:v=1:a=0[concat_v]" -map "[concat_v]" -pix_fmt
> > yuv420p t_after_input.mp4
> -ss and -t when used as output options, take effect *after* filtering,
> so you're actually trimming the output from the concat filter.
I did not realize that, thank you for explaining how it would apply.
> Use the trim filters instead.
> ffmpeg -y -i countdownclock_720p2398_21min.mp4 -filter_complex \
> [v2]trim=st=1257.256:d=4.004,setpts=PTS-STARTPTS[v2]; \
> [v1][v2]concat=n=2:v=1:a=0,format=yuv420p" t_after_input.mp4
Thank you for this example, I had not thought about the trim function. I do
agree that it does take a bit more time. I came up with this hybrid
approach as I was fine with leaving -ss before the input:
ffmpeg -y -ss 86.086 -i countdownclock_720p2398_21min.mp4 -ss 1257.256 -i
-t 8.008 -map "[concat_v]" -pix_fmt yuv420p t_after_input_v2.mp4
> In this case, you can also use the select filter since you're working on
> one input.
> ffmpeg -y -i countdownclock_720p2398_21min.mp4 -vf
> ,format=yuv420p" t_after_input.mp4
I had trouble with this example where my output file where between the
first clip the next frame displays for over 19 minutes and then shows the
second clip creating a file that is 19 minutes 35 seconds.
>ffmpeg -y -i countdownclock_720p2398_21min.mp4 -filter_complex
-map "[v1]" -pix_fmt yuv420p select.mp4
More than 1000 frames duplicated 0kB time=00:00:01.16 bitrate=
0.3kbits/s speed=0.0542x frame=28176 fps=382 q=-1.0 Lsize= 3025kB
time=00:19:35.04 bitrate= 21.1kbits/s dup=27984 drop=0 speed=15.9x
video:2694kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 12.269290%
Note that both these methods will be slower than input ss/t.
I appreciate the help pointing me to the trim filter, this is what I should
be using instead of trying to move the -t option.
More information about the ffmpeg-user