[FFmpeg-user] whats wrong with select between filter syntax

Travis Kelley rhatguy at gmail.com
Fri Jan 3 22:52:07 CET 2014


On Fri, Jan 3, 2014 at 4:44 PM, Clément Bœsch <u at pkh.me> wrote:
> On Fri, Jan 03, 2014 at 04:37:49PM -0500, Travis Kelley wrote:
>> I tried the gt/lt combination you suggested and it seems to work for the
>> greater than clause.  In other words it doesn't stop encoding when it hits
>> the less than time.  I tried reversing the gt/lt in the expression, but
>> that didn't seem to matter either.  Either way I specify, I see ffmpeg run
>> though the first few seconds of video very quickly until it hits the gt
>> time, then it seems to continue encoding forever.
>>
>
> It's probably because it's decoding the whole video: ffmpeg doesn't have
> visibility on what the filters actually do, and here the filter will just
> drop some frames, but ffmpeg will nevertheless feed it with the whole
> stream. You likely want to simply use -ss and -t (or -to in recent
> versions), or eventually the segmenter¹.
>
> Also, in your case, if you don't want very accurate cut, you can probably
> just remux and thus make the extraction lossless.

Actually it looks like it was walking through the video copying the
audio only since I hadn't specified a select filter for the audio yet.
 I ran the same command with -an to null out the audio and got a 10
second video as I expected.  Now I just need to figure out why I don't
have the aselect filter.  I suspect its probably due to the older
version of ffmpeg.

This line ended up working to produce a 10 second file of just the video

ffmpeg -i "input.mp4" -vf "select='lt(t,10)'" -an -c:v libx264 -preset
veryfast -profile:v high -level 4.1 -movflags +faststart -b:v 100k
/tmp/output.mp4

I'll continue looking into how to string these together in an OR
scenario so I can cut out multiple segments of video.

Thanks for your help!  You can't get help this responsive from a
commercial company!

>
>> #  ffmpeg -i "input.mp4" -vf "select='gt(t,30)*lt(t,60)'" -c:v libx264
>> -preset veryfast -profile:v high -level 4.1 -movflags +faststart -b:v 100k
>> -ar 44100 -ac 2 -ab 96k /tmp/output.mp4
>>
>> ffmpeg -i "input.mp4" -vf "select='lt(t,30)*gt(t,20)'" -c:v libx264 -preset
>> veryfast -profile:v high -level 4.1 -movflags +faststart -b:v 100k -ar
>> 44100 -ac 2 -ab 96k /tmp/output.mp4
>>
>> As for the verison...gentoo only has 1.0.8 in its package repository marked
>> stable.  1.2.4 is the newest version with built gentoo packages, but its
>> marked as unstable.  I might look into building a newer version directly
>> from source for my needs.
>>
>
> 1.2.4 is also very old.
>
>> Thanks Clément!
>>
>
> PS: please do not top post, it's considered rude.
>
> [1]: http://ffmpeg.org/ffmpeg-formats.html#segment_002c-stream_005fsegment_002c-ssegment
>
> --
> Clément B.
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>


More information about the ffmpeg-user mailing list