[FFmpeg-user] LLossless (10 Bit RGB 444) and (10 Bit YUV 422) Compression

Jason Freets jasonslife at hotmail.com
Fri Dec 26 23:11:05 CET 2014




Exciting, my first reply in a mailing list ... =). See my response below ...

> Jason Freets <jasonslife <at> hotmail.com> writes:
> 
> > My first time ever using a mailing list. 
> > 
> > About 1 year ago, I started investigating if FFmpeg 
> > can compress lossless in two ways:
> 
> When I fixed your issue eleven months ago, I didn't 
> know how to contact you: I suggest you post all questions 
> (and especially all bug reports) here on the user mailing 
> list.

Yes, I didn't get a response until a few months later in my post. I therefore, stopped checking in to that specific thread. But, I saw the suggestion most recently and so I did just that. And so here I am now.

> 
> > #1) 10 Bit YUV 422 r210 Original (lossless uncompressed) 
> > -> to FFV (lossless compressed) -> back to 10 Bit
> > YUV 422 r210 (lossless uncompressed)
> 
> I don't know much about r210 but I can assure you it is a 
> RGB codec...

My mistake, I meant to write v210 (10 Bit YUV 422 v210) instead of r210 (which for all I know is made up and a typo). FFMpeg handles v210 lossless conversions flawlessly. At least in my past testing, the recent fixes and updates to FFMpeg have made v210 lossless conversions work without glitches. In the past, once in awhile I would get a glitch in a frame. However, I've most recently not had that issue.  

However, I am soon to re-run the v210 conversions for verification purposes soon. When I say conversions, I mean 10 Bit from YUV 422 v210 (lossless) -> to FFV (lossless compressed) -> back to YUV 422 v210 (lossless).

Still, it was not possible to use FFMPEG to do the same with r10k (10 Bit RGB 444) such as Blackmagic or AJA codecs.

> 
> > #2) 10 Bit RGB 444 r10k  Original (lossless uncompressed) 
> > -> to FFV (lossless compressed) -> back to 10 Bit
> > RGB 444 r10k (lossless uncompressed).
> 
> ... just like r10k, they are technically nearly identical,
> 
> As said, I fixed lossless compression with ffv1 for both 
> r210 RGB and r10k RGB in January. If it fails for you, 
> please provide your command line together with the 
> console output here on the mailing list, please do not 
> use external resources (except for samples).

Ok, see below: 

///////////////////////////////////////////////////////////////////////////////
// FFMpeg r10k (lossless 10bit RGB 444 r10k) to FFV (compressed lossless)
///////////////////////////////////////////////////////////////////////////////

E:\ffmpeg-20141225-git-1515bfb-win64-static>ffmpeg -i "r10kOriginalFile.avi" -pi
x_fmt gbrp10le -vcodec ffv1 -coder 1 -c:a copy r10kToFFV.avi -f framemd5 -an r10
kToFFV.framemd5
ffmpeg version N-68675-g1515bfb Copyright (c) 2000-2014 the FFmpeg developers
  built on Dec 24 2014 23:09:08 with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
 --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 16.100 / 56. 16.100
  libavformat    56. 16.101 / 56. 16.101
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  5.101 /  5.  5.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, avi, from 'r10kOriginalFile.avi':
  Duration: 00:12:30.75, start: 0.000000, bitrate: 335621 kb/s
    Stream #0:0: Video: r10k (r10k / 0x6B303172), rgb48le(10 bpc), 720x486, 3356
02 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
File 'r10kToFFV.avi' already exists. Overwrite ? [y/N] n
Not overwriting - exiting

E:\ffmpeg-20141225-git-1515bfb-win64-static>ffmpeg -i "r10kOriginalFile.avi" -pi
x_fmt gbrp10le -vcodec ffv1 -coder 1 -c:a copy r10kToFFV.avi -f framemd5 -an r10
kToFFV.framemd5
ffmpeg version N-68675-g1515bfb Copyright (c) 2000-2014 the FFmpeg developers
  built on Dec 24 2014 23:09:08 with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
 --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 16.100 / 56. 16.100
  libavformat    56. 16.101 / 56. 16.101
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  5.101 /  5.  5.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, avi, from 'r10kOriginalFile.avi':
  Duration: 00:12:30.75, start: 0.000000, bitrate: 335621 kb/s
    Stream #0:0: Video: r10k (r10k / 0x6B303172), rgb48le(10 bpc), 720x486, 3356
02 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
Output #0, avi, to 'r10kToFFV.avi':
  Metadata:
    ISFT            : Lavf56.16.101
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), gbrp10le, 720x486, q=2-31, 200
 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.16.100 ffv1
Output #1, framemd5, to 'r10kToFFV.framemd5':
  Metadata:
    encoder         : Lavf56.16.101
    Stream #1:0: Video: rawvideo (RGB0 / 0x30424752), rgb48le(10 bpc), 720x486,
q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.16.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (r10k (native) -> ffv1 (native))
  Stream #0:0 -> #1:0 (r10k (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame=    7 fps=0.0 q=0.0 q=0.0 size=    5659kB time=00:00:00.23 bitrate=198477.
frame=   16 fps= 15 q=0.0 q=0.0 size=   12930kB time=00:00:00.53 bitrate=198401.
frame=   25 fps= 16 q=0.0 q=0.0 size=   20224kB time=00:00:00.83 bitrate=198609.

< ... data omitted ...>

frame=22469 fps= 13 q=0.0 q=0.0 size=25877166kB time=00:12:29.71 bitrate=282754.
frame=22477 fps= 13 q=0.0 q=0.0 size=25885932kB time=00:12:29.98 bitrate=282750.
frame=22484 fps= 13 q=0.0 q=0.0 size=25893498kB time=00:12:30.21 bitrate=282744.
frame=22491 fps= 13 q=0.0 q=0.0 size=25901574kB time=00:12:30.44 bitrate=282744.
frame=22498 fps= 13 q=0.0 q=0.0 size=25908966kB time=00:12:30.68 bitrate=282737.
frame=22500 fps= 13 q=0.0 Lq=0.0 size=25911354kB time=00:12:30.75 bitrate=282738
.3kbits/s
video:72043001kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB mux
ing overhead: unknown

E:\ffmpeg-20141225-git-1515bfb-win64-static>


///////////////////////////////////////////////////////////////////////////////
// FFMpeg FFV (compressed lossless) back to r10k (lossless 10bit RGB 444 r10k)
// NOTE: the resulting r10k created should be like the original r10k. At least
//       that is the goal.
//
// Take notice of the WARNING in the run below:  
//
// "Incompatible pixel format 'gbrp10le' for codec 'r10k', auto-selecting format 'rg
// b48le'"
// 
// "[swscaler @ 000000000568b8c0] full chroma interpolation for destination format '
// rgb48le' not yet implemented"
///////////////////////////////////////////////////////////////////////////////


E:\ffmpeg-20141225-git-1515bfb-win64-static>ffmpeg -i r10kToFFV.avi -pix_fmt gbr
p10le -vcodec r10k -c:a copy FFVTor10k.avi -f framemd5 -an FFVTor10k.framemd5
ffmpeg version N-68675-g1515bfb Copyright (c) 2000-2014 the FFmpeg developers
  built on Dec 24 2014 23:09:08 with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
 --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 16.100 / 56. 16.100
  libavformat    56. 16.101 / 56. 16.101
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  5.101 /  5.  5.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, avi, from 'r10kToFFV.avi':
  Metadata:
    encoder         : Lavf56.16.101
  Duration: 00:12:30.75, start: 0.000000, bitrate: 282738 kb/s
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), gbrp10le, 720x486, 282746 kb/s
, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
Incompatible pixel format 'gbrp10le' for codec 'r10k', auto-selecting format 'rg
b48le'
[swscaler @ 000000000568b8c0] full chroma interpolation for destination format '
rgb48le' not yet implemented
Output #0, avi, to 'FFVTor10k.avi':
  Metadata:
    ISFT            : Lavf56.16.101
    Stream #0:0: Video: r10k (R10k / 0x6B303152), rgb48le, 720x486, q=2-31, 200
kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.16.100 r10k
Output #1, framemd5, to 'FFVTor10k.framemd5':
  Metadata:
    encoder         : Lavf56.16.101
    Stream #1:0: Video: rawvideo (G3[0][10] / 0xA003347), gbrp10le, 720x486, q=2
-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.16.100 rawvideo
Stream mapping:
  Stream #0:0 -> #0:0 (ffv1 (native) -> r10k (native))
  Stream #0:0 -> #1:0 (ffv1 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
frame=    9 fps=0.0 q=0.0 q=0.0 size=   12307kB time=00:00:00.30 bitrate=335740.
frame=   24 fps= 23 q=0.0 q=0.0 size=   32811kB time=00:00:00.80 bitrate=335646.
frame=   35 fps= 22 q=0.0 q=0.0 size=   47846kB time=00:00:01.16 bitrate=335628.
frame=   48 fps= 23 q=0.0 q=0.0 size=   65616kB time=00:00:01.60 bitrate=335617.

< ... rest of data omitted ...>

///////////////////////////////////////////////////////////////////////////////
// end
///////////////////////////////////////////////////////////////////////////////

In the conversion from FFV1 back to r10k the following warning is reported:

"Incompatible pixel format 'gbrp10le' for codec 'r10k', auto-selecting format 'rg
b48le'
[swscaler @ 000000000568b8c0] full chroma interpolation for destination format '
rgb48le' not yet implemented"

Take note that ffmpeg -pix_fmts reports: 
IO... gbrp10be               3            30
IO... gbrp10le               3            30

So I would imagine that I should be able to output back to 10 bit r10k. This doesn't seem to work.

I'd also like to point out that the resulting file that is created from my original r10k to FFV1 which resulted in the file r10kToFFV.avi that was created DOES NOT PLAY IN VLC! So what do I see when playing the r10kToFFV.avi? Video does play but it's all green (i.e. all frames as the video plays is all green). So the video plays, but there is nothing but SOLID green to watch. This is just to say that going from my original r10k to FFV1 also has issues with FFMpeg. 

> 
> > By then I was using Zeranoe FFmpeg already as I 
> > gave up using VideoLan's. 
> 
> There is some misunderstanding:
> FFmpeg only provides source code (no "products"), 
> videolan is kindly supporting FFmpeg with their 
> server, meaning FFmpeg is available through the 
> videolan git repository (there are mirrors but 
> videolan is our official git archive).
> Zeranoe takes the FFmpeg sources from videolan 
> and compiles them for the community.

I may be confusing the testing with their x264 product:

http://www.videolan.org/developers/x264.html

I've attempted to compress v210 using x264 as an alternative to FFMpeg. However, that's another story. FFMpeg handles v210 fine, so I'm focused currently on r10k lossless compression which is what FFMpeg doesn't seem to like (the 10bit format). 

> 
> > Thanks! And since today's Christmas, Merry 
> > Christmas to all!
> 
> Merry Christmas to you too!
> 
> Carl Eugen
> 
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

 		 	   		  


More information about the ffmpeg-user mailing list