[FFmpeg-user] the trim filter

Jim DeLaHunt list+ffmpeg-user at jdlh.com
Sat Jul 6 13:14:08 EEST 2024


On 2024-07-05 18:18, Mark Filipak wrote:

> ...
> Well, I separated video & audio into separate streams but got the same 
> result:
> "Media type mismatch between the 'Parsed_split_0' filter output pad 1 
> (video) and the 'Parsed_atrim_2' filter input pad 0 (audio)"
> So, the video stream is going right through '[o5v],[i5a]' ....

That's not how I interpret the wording "between the 'Parsed_split_0' 
filter output pad 1 (video) and the 'Parsed_atrim_2' filter input pad 0 
(audio)".

I suspect that "'Parsed_split_0' filter" refers to filter 
"split=8[i5v][i5a][i6v][i6a][i7v][i7a][i8v][i8a]". "Output pad 1" (in 
0-based numbering) of that filter is "[i5a]". The "(video)" says that 
"[i5a]" is a video stream.

I suspect that the "'Parsed_atrim_2' filter" refers to filter 
"[i5a]atrim=start=20.062:end=5590.835[o5a]". This filter expects an 
audio stream at its input pad.

> G:\>ffmpeg -i g:\00305+00306+00307+00308.m2ts -filter_complex 
> "split=8[i5v][i5a][i6v][i6a][i7v][i7a][i8v][i8a], 
> [i5v]trim=start_frame=481:end_frame=134047[o5v], 
> [i5a]atrim=start=20.062:end=5590.835[o5a], [o5v][o5a]interleave[o5], 
> [i6v]trim=start_frame=138745:end_frame=246719[o6v], 
> [i6a]atrim=start=5786.823:end=10290.197[o6a], 
> [o6v][o6a]interleave[o6], 
> [i7v]trim=start_frame=251486:end_frame=333310[o7v], 
> [i7a]atrim=start=10489.062:end=13901.805[o7a], 
> [o7v][o7a]interleave[o7], [i8v]trim=start_frame=338018[o8v], 
> [i8a]atrim=start=14098.167[o8a], 
> [o8v][o8a]interleave[o8],[o5][o6][o7][o8]concat=n=4[o]" -map "[o]" 
> -c:v libx265 -x265-params crf=16 -c:a dts -strict -2 -sn 
> -start_at_zero e:\00305+00306+00307+00308.mp4

Just a wild guess: try adding ":a" after each input label before 
"atrim". So, "[i5a]atrim=start=20.062:end=5590.835[o5a]" becomes 
"[i5a:a]atrim=start=20.062:end=5590.835[o5a]". And so on for the other 
three atrim filters.

What error message results after that change?


> ...I've never had to do this before. I'm in unknown territory....

Oh yeah, me too.

Best regards,
      —Jim DeLaHunt




More information about the ffmpeg-user mailing list