[Libav-user] Coversion from YUV to RGB loss of image details

Alex Cohn alexcohn at netvision.net.il
Wed Jun 6 08:32:05 CEST 2012


On Wed, Jun 6, 2012 at 9:12 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> Sampath Subasinghe <susiriss at ...> writes:
>
> >      I was wondering whether this is what you meant.
>
> This is broken (because odd width is not supported by
> yuv rawvideo):
> ffmpeg -i ref.ppm ref.yuv
> ffmpeg -s 45x32 -i ref.yuv ref2.ppm
>
> The following does work and produces the same black edge:
> $ ffmpeg -i out.ppm -pix_fmt yuv420p -strict experimental out.ljpg
> $ ffmpeg -i out.ljpg ref2.ppm
>
> Carl Eugen
>

I am not using the latest build, but for me the round-trip worked without
artifacts, see attached images and console output:

*ffmpeg -i C:\Users\acohen\Downloads\ref.ppm  -pix_fmt yuv420p t.yuv
**ffmpeg version N-35295-gb55dd10, Copyright (c) 2000-2011 the FFmpeg
developers built on Nov 30 2011 00:58:17 with gcc 4.6.2
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r
--enable-libope
ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm
--enable-libmp3lame --enable-libopenjpeg --enable-librtmp
--enable-libschroedinger --enable-libspeex --enable-libtheora
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib*
*  libavutil    51. 29. 1 / 51. 29. 1
  libavcodec   53. 39. 1 / 53. 39. 1
  libavformat  53. 22. 0 / 53. 22. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 50. 0 /  2. 50. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
*Input #0, image2, from 'C:\Users\acohen\Downloads\ref.ppm':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: ppm, rgb24, 45x32, 25 tbr, 25 tbn, 25 tbc
w:45 h:32 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 00000000003369B0] auto-inserting filter 'auto-inserted scale
0' between the filter 'src' and the filter 'out'
[scale @ 0000000000337C60] w:45 h:32 fmt:rgb24 -> w:45 h:32 fmt:yuv420p
flags:0x4
Output #0, rawvideo, to 't.yuv':
  Metadata:
    encoder         : Lavf53.22.0
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 45x32,
q=2-31, 20
0 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (ppm -> rawvideo)
Press [q] to stop, [?] for help
frame=    1 fps=  0 q=0.0 Lsize=       2kB time=00:00:00.04 bitrate=
435.2kbits/s
video:2kB audio:0kB global headers:0kB muxing overhead 0.000000%

*ffmpeg -pix_fmt yuv420p -s 45x32 -i t.yuv t.ppm*
[rawvideo @ 000000000038D660] Estimating duration from bitrate, this may be
inaccurate
Input #0, rawvideo, from 't.yuv':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 45x32, 25
tbr, 25
 tbn, 25 tbc
Incompatible pixel format 'yuv420p' for codec 'ppm', auto-selecting format
'rgb24'
[buffer @ 000000000038D5E0] w:45 h:32 pixfmt:yuv420p tb:1/1000000 sar:0/1
sws_param:
[buffersink @ 000000000038F490] auto-inserting filter 'auto-inserted scale
0' between the filter 'src' and the filter 'out'
[scale @ 000000000038F6F0] w:45 h:32 fmt:yuv420p -> w:45 h:32 fmt:rgb24
flags:0x4
Output #0, image2, to 't.ppm':
  Metadata:
    encoder         : Lavf53.22.0
    Stream #0:0: Video: ppm, rgb24, 45x32, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> ppm)
Press [q] to stop, [?] for help
frame=    1 fps=  0 q=0.0 Lsize=       0kB time=00:00:00.04 bitrate=
0.0kbits/s
video:4kB audio:0kB global headers:0kB muxing overhead -100.000000%
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120606/7c172637/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.ppm
Type: image/x-portable-pixmap
Size: 4333 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120606/7c172637/attachment.ppm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.yuv
Type: application/octet-stream
Size: 2176 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120606/7c172637/attachment.obj>


More information about the Libav-user mailing list