[FFmpeg-user] About the command -vcodec
Werner Robitza
werner.robitza at gmail.com
Sun Sep 15 19:13:55 CEST 2013
On Sun, Sep 15, 2013 at 5:59 PM, 陈立 <kidney at mail.ustc.edu.cn> wrote:
> How did ffmpeg decode it with the parameter "rawvideo"?
Not knowing too much about the internals, I'll keep this abstract and say:
* it just reads the file byte-by-byte
* it parses the Y, U and V components from there. You can see how the
bytes in a YUV file can be composed here: http://fourcc.org/yuv.php
> And what encoder did it use to encode then? Did any intra or inter prediction, quantization or arithmetic coding happen during the
> decoding and encoding process?
While reading the file, ffmpeg holds a representation of each frame
(http://ffmpeg.org/doxygen/trunk/structAVFrame.html). Depending on
whether you apply any filters or transformations, it will change that
raw content, and after that – just like reading from a specific
byte-format – it writes the frames to a file according to the YUV byte
order you chose (e.g. planar YUV 4:2:0, or UYVY 4:2:2, etc.).
There is no inter prediction, quantization or arithmetic coding
happening when you encode to rawvideo. Like the name says, it's just
raw video, frame by frame, pixel by pixel, written to a file. This is
also the reason you need to tell ffmpeg how to read the input file,
since there's no container format that'd tell you when a frame ends
and where the next one starts. It's just a stream of bytes, for each
pixel in every frame.
> I used the
>
> ffmpeg -vcodec rawvideo -pix_fmt yuv420p -s 1024x768 -r 30 -i balloons1.yuv -vcodec rawvideo -pix_fmt yuvy422
> -frames 1 -r 30 balloons1_output.yuv
>
> And then program myself to "fread" the balloons1_output.yuv according to yuvy422 format, and all of the pixels
> and be read out into the memory without any decoder and encoder process. So what did the decoder and encoder in ffmpeg do?
I hope I understand your question correctly, but (basically iterating
what I explained above) the decoder and encoder didn't really do much
except for reading the bytes and writing the bytes in the correct
order.
More information about the ffmpeg-user
mailing list