[FFmpeg-user] h264 lossless grayscale

tim nicholson nichot20 at yahoo.com
Fri Apr 24 08:20:24 CEST 2015


On 23/04/15 09:54, Marco Porsch wrote:
> Hi,
> 
> when encoding an 8bit grayscale video using the commandline
> # ffmpeg.exe -f rawvideo -vcodec rawvideo -pix_fmt gray -s 1280x960 -r 30 -i out8.yuv -c:v libx264 -qp 0 -preset ultrafast -y out8.mkv
> and decoding using
> # ffmpeg.exe -i out8.mkv -f rawvideo -c:v rawvideo -pix_fmt gray -y out8_decoded.yuv
> I get two bit-identical .yuv files. Correct.
> 
> When doing the same with a 16bit grayscale video using the command lines
> # ffmpeg.exe -f rawvideo -vcodec rawvideo -pix_fmt gray16le -s 1280x960 -r 30 -i out16.yuv -c:v libx264 -qp 0 -preset ultrafast -y out16.mkv
> # ffmpeg.exe -i out16.mkv -f rawvideo -c:v rawvideo -pix_fmt gray16le -y out16_decoded.yuv
> the resulting files are not identical.
> 
> Any explanation for this behavior? Am I doing something wrong?
> 
> Best regards,
> --Marco
> 
> 
> D:\Users\Porsch\Develop\LoggingApp\tools\build\vs12\dl4log_mux>d:\Tools\ffmpeg-20150109-git-d1c6b7b-win32-shared\bin\ffm
> peg.exe -f rawvideo -vcodec rawvideo -pix_fmt gray -s 1280x960 -r 30 -i out8.yuv -c:v libx264 -qp 0 -preset ultrafast -y
>  out8.mkv
> [...]
> [libx264 @ 0093cfe0] profile High 4:4:4 Predictive, level 3.2, 4:4:4 8-bit
> [...]
> 

> D:\Users\Porsch\Develop\LoggingApp\tools\build\vs12\dl4log_mux>d:\Tools\ffmpeg-20150109-git-d1c6b7b-win32-shared\bin\ffm
> peg.exe -f rawvideo -vcodec rawvideo -pix_fmt gray16le -s 1280x960 -r 30 -i out16.yuv -c:v libx264 -qp 0 -preset ultrafa
> st -y out16.mkv
>[...]
> [libx264 @ 0071d140] profile High 4:4:4 Predictive, level 3.2, 4:4:4 8-bit
> [...]


In both cases you have created an 8bit h264 file, why would you then
expect the conversion back to be bit exact?

(x264 supports 8 or 10 bit and needs compiling explicitely for the
required bit depth)

-- 
Tim.
Key Fingerprint 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83


More information about the ffmpeg-user mailing list