[FFmpeg-devel] -vf copy does transcode rather than copy

David Favor david at davidfavor.com
Thu Oct 31 20:02:00 CET 2013

Michael Bradshaw wrote:
> On Thu, Oct 31, 2013 at 11:28 AM, David Favor <david at davidfavor.com> wrote:
>> Maybe I'm missing something.
>> The copy filter states...
>>    http://ffmpeg.org/ffmpeg-**filters.html#copy<http://ffmpeg.org/ffmpeg-filters.html#copy>
>>    Copy the input source unchanged to the output. Mainly useful for
>> testing purposes.
>> Test case below shows input video bitrate is 938 kb/s output video bitrate
>> is 836 kb/s
>> and ffmpeg output shows libx264 is transcoding.
> If you want to copy the stream without re-encoding it, don't you want -c:v
> copy instead of -vf copy?
> The copy filter just copies the input data to the output. But the input is
> decoded video frames (which it then copies to the output). Note that input
> and output here are referring to the filter graph, not the input/output
> files.
> Data gets decoded -> Goes into filter graph -> "copy" filter just does a
> straight copy of the data -> Goes out of the filter graph -> Gets encoded
> by your command line parameters (and here it seems to be using defaults,
> because you haven't specified any).
> Someone please correct me if I'm wrong, though.

-c:v copy maintains SAR + DAR info.

-vf copy should allow (to me) a filter chain of something like...

     -vf copy,setdar=dar=0,setsar=sar=0

which should accomplish the following...

     1) copy the video stream (bit for bit) so no transcode

     2) completely remove SAR + DAR to repair broken videos

Bug is this....

     ffmpeg -i in.mp4 -c:a copy -vf copy out.mp4

does a transcode instead of a copy... so it appear that -vf copy simply
does not work.

A work around for my situation is to override SAR + DAR in video stream
via setting it in the container... via...

     ffmpeg -i in.mp4 -c:a copy -c:v copy -aspect 16:9 out.mp4

And -vf copy still appears broken and should be fixed as there are other
situations where video streams should be copied bit for bit.

Love Living Well Doing What You Love?
http://DavidFavor.com/books can help!

More information about the ffmpeg-devel mailing list