[FFmpeg-user] Why does '-c:v copy' decode video frames?
Yukun Guo
gyk.net at gmail.com
Fri Feb 22 19:28:03 EET 2019
Thank you for the very helpful replies!
I was busy experimenting with FFmpeg yesterday but got lost in the
complicated codebase. So far I have found FFmpeg keeps decoding frames
until it has collected enough information. In my particular case, it
is the third condition in this while loop
https://github.com/FFmpeg/FFmpeg/blob/n3.4.2/libavformat/utils.c#L3002
evaluating to false that ends the slice decoding.
...the properties are typically necessary for the muxer to actually
> implement "-c copy" (even if not needed in all cases).
>
This is exactly what I missed: the muxer is designed for general
purpose so it will go through all the steps. For the same reason
`ffmpeg -i src.flv -c copy -f flv dst.flv` doesn't mean a file copy.
...it is just calculating the mv. If slice data partitioning is
> used (or maybe regardless, don’t remember) the equation for motion
> vector needs at least the field order list and sub/mb partition
> indexes for the current and colocated mbs
>
I still can't understand this. Why does FFmpeg need MVs? My guess is
calculating MVs is just a byproduct of extracting the metadata.
On Thu, 21 Feb 2019 at 07:21, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 2019-02-20 10:32 GMT+01:00, Ted Park <kumowoon1025 at gmail.com>:
> >> The original video seems problematic, so FFmpeg outputs
> >> several lines of "co located POCs unavailable" error. The
> >> error message is printed in
> `h264_direct.c/ff_h264_direct_ref_list_init`,
> >> which is further called by `h264dec.c/h264_decode_frame`.
> >> What confuses me is why does the copy codec still try
> >> to decode H.264 frames and even do motion vector prediction?
> >
> > It doesn’t.
>
> I may misunderstand this but in any case as Moritz explained
> libavformat will use the decoder to know the properties of the
> stream (you cannot avoid this), the properties are typically
> necessary for the muxer to actually implement "-c copy" (even
> if not needed in all cases).
> Not all frames are decoded but some frames in the
> beginning of the stream (for some codecs).
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://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