nschlia / ffmpegfs

FUSE-based transcoding filesystem with video support from many formats to FLAC, MP4, TS, WebM, OGG, MP3, HLS, and others.
https://nschlia.github.io/ffmpegfs/
GNU General Public License v3.0
198 stars 14 forks source link

Additional Prores Option for Quality Levels #19

Closed nschlia closed 5 years ago

nschlia commented 5 years ago

As an extra you could have different prores quality levels depending on the source pixformat, for instance ProRes 4:4:4 if the source is RGB and ProRes 4:2:2 if the source is YUV.

See #9.

mufunyo commented 5 years ago

Because there are more formats that require a ProRes 4444 than would be compatible with ProRes 422, I have listed the ProRes 422 formats below, and any other format not on this list should be encoded with ProRes 4444. The rationale for this segregation was as follows:

Basically, any format with 4:2:2 sampling or worse, and 10 bit per component bitdepth or worse can be safely transcoded to ProRes 422, and anything else needs to be transcoded to ProRes 4444 to preserve chroma resolution, bitdepth and/or alpha. Luckily most video files in the wild will be yuv420p.

And now on to the list:

yuv420p
yuyv422
yuv422p
yuv410p
yuv411p
gray
monow
monob
yuvj420p
yuvj422p
uyvy422
nv12
nv21
yuv420p9be
yuv420p9le
yuv420p10be
yuv420p10le
yuv422p10be
yuv422p10le
yuv422p9be
yuv422p9le
gray10be
gray10le
gray9be
gray9le

Also note there are some formats in ffmpeg's pix_fmts list that are unsupported as an input format, so I have omitted those.

mufunyo commented 5 years ago

To encode in the different variants of ProRes, you can either specify them as profile, where 4 is ProRes 4444 and 3 is ProRes 422 HQ, or as codec_tag_string, in which case ap4h is ProRes 4444 and apch indicates ProRes 422 HQ.

nschlia commented 5 years ago

I think that big/little endian makes no difference, and with the demise of PowerPC I'll select little endian. Intel/AMD/ARM Little Endian/Snap Dragon and such. I'll work out a matrix that will select the best choice output pixel format.

nschlia commented 5 years ago

Using avcodec_find_best_pix_fmt_of_list to find best match pixel format.

nschlia commented 5 years ago

Added quality level selection:

https://github.com/nschlia/ffmpegfs/commit/bda296f650c3803fae309870f34d4569cf82cdbb

The best option pixel format will be selected automatically.