Video Compression

VideoNerd

Apple ProRes is a particular standard (different from H.264/AVC) developed by Apple to replace M-JPEG. ProRes is tailored to support 4:2:2 and 4:4:4 video with 8,10 and 12 bits per sample.

The ProRes codec (both encoder and decoder) is supported by ffmpeg (by default).

ffmpeg -codecs | findstr prores

DEVIL. prores               Apple ProRes (iCodec Pro) (encoders: prores prores_aw prores_ks)

It’s easy also to extract the ProRes codec as a standalone program.

There are several realizations of ProRes in ffmpeg: Anatoliy’s variant ( ‘-vcodec prores’ ) , Kostia’s variant (‘-vcodec prores_ks’).

ProRes supports the following profiles:

Profile Num                     Profile Name

———————————————————–

0 ………… ……………………ProRes 422, Proxy
1 ………… ……………………ProRes 422, LT
2 ……………………………… ProRes 422, Standard
3 ……….. …………………….ProRes 422, HQ

 

       Generating ProRes Stream with ffmpeg

All ProRes files names must end with ‘mov’ extension. As far as i know VLC, PotPlayer and QuickTime players support ProRes streams.

The following ffmpeg example reveals how to encode an input 4:2:0 yuv-file (yuv420p) to ProRes mov-file (4:2:2):

ffmpeg -s 3840×1744 -y -pix_fmt yuv420p    -i   a.yuv     -vcodec prores     a_prores.mov

Note: because  ProRes does not support 4:2:0, the input yuv420p is converted by default to 4:2:2, 10bps (yuv422p10le)

If we want to generate ProRes Proxy profile with a predefined frame rate say 24fps  and profile 0 (ProRes 422, Proxy) then use -r 24 and -profile:v 0 :

 ffmpeg -s 3840×1744 -y -pix_fmt yuv420p -i a.yuv -r 24 -vcodec prores -profile:v 0   proxy.mov

If we wish select ProRes 422, LT profile we should use ‘-profile:v 1’ (because ProRes 422,   LT profile has the number 1 in the above table)

 

              How Keep BitRate

For BitRate control you need use Kostia’s realization of ProRes (specified by ‘-vcodec prores_ks’). The bitrate is controlled by bits_per_mb parameter which specifies how many bits to supply for coding single MB.

Thus the expected bitrate is capped by:   (frame_width/16) * (frame_height/16) * fps * bits_per_mb

Usage:

ffmpeg -s 3840×1744 -y -pix_fmt yuv420p -i a.yuv -bits_per_mb 300 -r 24 -vcodec prores_ks -profile:v 0 a_prores_proxy_300.mov

It’s recommended to allocate 250 bits per mb for Proxy profile, 525 bits per mb for LT profile, 875 bits per mb for Standard profile and 1350 bits per mb for HQ profile.

 

           How Set Aspect Ratio

Aspect ratio is signaled in meta-data (in pasp-atom, moov/trak/mdia/minf/stbl/stsd/ ) and set by ffmpeg key ‘-vf setdar=K:M’.
The following example reveals how to set 16:9 aspect ratio:

ffmpeg -s 3840×1744 -y -pix_fmt yuv420p -i a.yuv -bits_per_mb 300 -r 24 -vcodec prores_ks -profile:v 0 -vf setdar=16:9 test.mov

        

How ProRes Profile Signaled in Mov-Metadata

According to ProRes profile the following atom is signaled in moov/trak/mdia/minf/stbl/stsd/ :

apch – ProRes 422 High Quality
apcn – ProRes 422 Standard Definition
apcs – ProRes 422 LT
apco – ProRes 422 Proxy
ap4h – ProRes 4444

24 Responses

  1. I think this is one of the most important info for me. And i am glad reading your article. But should remark on some general things, The site style is wonderful, the articles is really nice : D. Good job, cheers

    1. you are welcome to ask our web-designer Ivan Lukin (vanyalukin007@gmail.com), i am responsible for the content only.

    1. Thanks for “auspicious”, my email is slavah264@gmail.com and you are welcome to correspond with me. i am corresponding with many specialists, beginners and practitioners in video compression and media streaming fields.

  2. Hiya, I am really glad I’ve found this info. Today bloggers publish just about gossips and internet and this is really irritating. A good site with exciting content, this is what I need. Thank you for keeping this web site, I will be visiting it. Do you do newsletters? Cant find it.

  3. Awsome article and right to the point. I am not sure if this is really the best place to ask but do you folks have any ideea where to employ some professional writers? Thanks 🙂

  4. It’s appropriate time to make a few plans for the long run and it’s time to be happy. I have learn this post and if I may I desire to counsel you few fascinating things or suggestions. Perhaps you could write next articles relating to this article. I want to read more issues about it!

Leave a Reply

Your email address will not be published. Required fields are marked *