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

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


On Wed, Jun 6, 2012 at 5:22 AM, Sampath Subasinghe <susiriss at gmail.com>wrote:

> On 06/05/2012 12:28 PM, Carl Eugen Hoyos wrote:
>
>> Sampath Subasinghe <susiriss at ...> writes:
>>
>>  1. RGB - YUV conversion
>>> 2. YUV - RGB conversion
>>>
>>> Issue is that in the image output from step 2, the right
>>> edge of the image is missing, means the pixels are black.
>>>
>> Is this also reproducible if you use ffmpeg (the application)?
>> If yes, please provide a command line and complete, uncut
>> console output.
>>
> Hi Carl,
>    I was wondering whether this is what you meant. I have the original
> image as a ppm image.
> then I do,
> ffmpeg - i ref.ppm ref.yuv
> which outputs following at the command line
>
> ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers
>  built on Apr 27 2012 07:58:14 with gcc 4.4.5
>  configuration: --enable-shared --enable-gpl --enable-nonfree
> --enable-x11grab --enable-libfaac --enable-libfreetype --enable-libmp3lame
> --enable-libx264 --enable-pic
>  WARNING: library configuration mismatch
>  avutil      configuration: --enable-gpl --enable-nonfree --enable-shared
> --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac
> --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic
>  avfilter    configuration: --enable-gpl --enable-nonfree --enable-shared
> --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac
> --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic
>  swresample  configuration: --enable-gpl --enable-nonfree --enable-shared
> --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac
> --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic
>  libavutil      51. 35.100 / 51. 47.100
>  libavcodec     53. 61.100 / 53. 61.100
>  libavformat    53. 32.100 / 53. 32.100
>  libavdevice    53.  4.100 / 53.  4.100
>  libavfilter     2. 61.100 /  2. 72.100
>  libswscale      2.  1.100 /  2.  1.100
>  libswresample   0.  6.100 /  0. 11.100
>  libpostproc    52.  0.100 / 52.  0.100
> Input #0, image2, from '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
> [buffer @ 0x1d457a0] w:45 h:32 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param:
> Output #0, rawvideo, to 'ref.yuv':
>  Metadata:
>    encoder         : Lavf53.32.100
>    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 45x32,
> q=2-31, 200 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=       4kB time=00:00:00.04 bitrate=
> 864.0kbits/s
> video:4kB audio:0kB global headers:0kB muxing overhead 0.000000%
> ------------------------------**-----
>
> Which of course has warnings in it.
>
> Then I do
>    ffmpeg -i ref.yuv ref.ppm
> which outputs following.
> ------------------------------**-----------
> ffmpeg -i ref.yuv ref.ppm
> ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers
>  built on Apr 27 2012 07:58:14 with gcc 4.4.5
>  configuration: --enable-shared --enable-gpl --enable-nonfree
> --enable-x11grab --enable-libfaac --enable-libfreetype --enable-libmp3lame
> --enable-libx264 --enable-pic
>  WARNING: library configuration mismatch
>  avutil      configuration: --enable-gpl --enable-nonfree --enable-shared
> --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac
> --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic
>  avfilter    configuration: --enable-gpl --enable-nonfree --enable-shared
> --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac
> --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic
>  swresample  configuration: --enable-gpl --enable-nonfree --enable-shared
> --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac
> --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic
>  libavutil      51. 35.100 / 51. 47.100
>  libavcodec     53. 61.100 / 53. 61.100
>  libavformat    53. 32.100 / 53. 32.100
>  libavdevice    53.  4.100 / 53.  4.100
>  libavfilter     2. 61.100 /  2. 72.100
>  libswscale      2.  1.100 /  2.  1.100
>  libswresample   0.  6.100 /  0. 11.100
>  libpostproc    52.  0.100 / 52.  0.100
> [IMGUTILS @ 0x7fff69baf6a0] Picture size 0x0 is invalid
> [IMGUTILS @ 0x7fff69baf580] Picture size 0x0 is invalid
> [rawvideo @ 0x1e8e3a0] decoding for stream 0 failed
> [rawvideo @ 0x1e8e3a0] Could not find codec parameters (Video: rawvideo,
> yuv420p)
> [rawvideo @ 0x1e8e3a0] Estimating duration from bitrate, this may be
> inaccurate
> ref.yuv: could not find codec parameters
> ------------------------------**-----------------------
> I know, my command has errors, but I don't have an idea as to how I should
> test the scenario you mentioned. Could you please give me a sample command
> line?
>
> thanks.
> -Sampath
>

To read yuv raw image, you must supply the picture size and pixel format on
the command line, e.g.

ffmpeg -s 45x32 -pix_fmt yuv420p -i ref.yuv ref.ppm

Regards,
Alex Cohn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120606/3abdda84/attachment.html>


More information about the Libav-user mailing list