[FFmpeg-user] Selecting/dropping frames without re-encoding

Francois Visagie francois.visagie at gmail.com
Fri Oct 7 11:13:04 EEST 2016


> -----Original Message-----
> From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of
> Moritz Barsnick
> Sent: 06 October 2016 18:34
> To: FFmpeg user discussions
> Subject: Re: [FFmpeg-user] Selecting/dropping frames without re-encoding
> 
> On Thu, Oct 06, 2016 at 16:07:02 +0200, Moritz Barsnick wrote:
> > I found the suggestion to use the concat demuxer with streamcopy very
> > interesting. Assuming it can seek and cut precisely, that could work -
> > again in theory. Let's experiment with that. :)
> 
> So, where are your results, everyone? ;-) Here are mine.
> 
> I created a 50 fps DNxHR MXF file. The testsrc2 filter/source kindly puts the
> frame numbers onto each frame:
> 
> $ ffmpeg -f lavfi -i testsrc2=s=hd720:r=50 -c:v dnxhd -profile:v dnxhr_hq -t 3
> input.mxf
> 
> I created a concat script for these three seconds, to select every second
> frame, which means stepping forward by 0.040 (two frames at 50 fps), for a
> duration of 0.020 (one frame):
> 
> $ perl -e 'print "ffconcat version 1.0\n\n"; my $t = 0; while ($t <= 3) {
> printf("file input.mxf\ninpoint %1.3f\nduration 0.020\noutpoint %1.3f\n\n",
> $t, $t + 0.020); $t += 0.040; }' > concatscript.txt
> 
> Then I used this concat demuxer script to do the actual extraction:
> 
> $ ffmpeg -r 25 -f concat -i concatscript.txt -c:v copy output.mxf
> 
> Visual inspection of the result shows me that every second frame was
> extracted, at a resulting frame rate of 25 fps.
> 
> Verifying with the frashhash demuxer showed me that every second frame
> is indeed identical:
> 
> $ ffmpeg -i input.mxf -c copy -f framehash input.mxf.hash $ ffmpeg -i
> output.mxf -c copy -f framehash output.mxf.hash
> 
> Bingo! :-)

Well done :-)

> 
> Still, a bitstream filter would be nifty. ;-)
> 
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email ffmpeg-user-request at ffmpeg.org
> with subject "unsubscribe".



More information about the ffmpeg-user mailing list