pngenc producing strange colours for certain devices

anno domini genericgroupmail at gmail.com
Mon Aug 11 05:50:49 PDT 2014


Hi All

So figured it out...i used the GST_DEBUG_DUMP_DOT_DIR facility to debug the
problem.
Here's how for anyone who may be interested (probably everyone knows this
but i'm not overly familiar with gstreamer debug etc):

By accident i noticed that if i included a timeoverlay element in the
pipeline then suddenly the image was perfect.
So ran this to generate the debug for the case that has the issue:

GST_DEBUG_DUMP_DOT_DIR=/tmp/ gst-launch -e v4l2src device=/dev/video1
norm=PAL ! ffmpegcolorspace ! pngenc snapshot=true ! filesink
location="frame.png"

And this for the case that doesnt have the issue:

GST_DEBUG_DUMP_DOT_DIR=/tmp/ gst-launch -e v4l2src device=/dev/video1
norm=PAL ! ffmpegcolorspace ! timeoverlay halign=right valign=bottom !
ffmpegcolorspace ! pngenc snapshot=true ! filesink location="frame.png"

Each of these generates a series of .dot files.
I then chose the PLAYING_PAUSED dot file for each and converted it to an
image using graphviz (on fedora this was by running yum install graphviz)
as follows:

dot -Tpng 0.00.00.357054443-gst-launch.PLAYING_PAUSED.dot >
not-working-pipeline.png
dot -Tpng 0.00.00.701629385-gst-launch.PLAYING_PAUSED.dot >
working-pipeline.png

Then displayed the images and looked for differences in what pngenc was
being given.
I noticed that the format being forwarded to the pngenc in each case was
different.
So i began to force the format after the v4l2src element bit by bit until
the image colors were fixed.
Turns out it was the bit depth (bpp) in my case that was the culprit so
this was the fix:

*v4l2src device=/dev/video1 norm=PAL ! ffmpegcolorspace ! valve
name=video_capture_valve drop=true ! videoscale ! video/x-raw-rgb, bpp=24,
width=720, height=576, pixel-aspect-ratio=1/1 ! pngenc snapshot=true
compression-level=1 ! filesink location="myimage.png"*

Hope this helps anyone else...




On Mon, Aug 11, 2014 at 10:11 AM, anno domini <genericgroupmail at gmail.com>
wrote:

> Hi All,
>
> I am using gstreamer bindings within a python script to generate an
> individual snapshot of the display from various video capture devices.
>
> I had been using pngenc to produce the snapshots with success with easycap
> cards and decklink/intensity pro cards.
>
> However, when we tried it on a different video capture device (bt878 card)
> i noticed all the snapshots had strange colors.
>
> This is the pipeline i was using:
>
> *v4l2src device=/dev/video1 norm=PAL ! ffmpegcolorspace ! valve
> name=video_capture_valve drop=true ! videoscale ! video/x-raw-rgb,
> width=720, height=576, pixel-aspect-ratio=1/1 ! pngenc snapshot=true
> compression-level=1 ! filesink location="myimage.png"*
>
> (In case you are wondering, the valve is used to delay capture for a few
> seconds because the intensity pro card seemed to produce several poor
> frames at the start).
>
> I couldn't figure out what the problem was so i opted to use the jpegenc
> instead which appeared to work for all the cards i.e. no funny colors with
> the BT878 card. However, unfortunately this wasn't a valid solution because
> this was producing very poor quality snapshots.
>
> Can anyone suggest what may be causing the funny colors with the pngenc
> and the BT878 video capture card??
>
> Thanks!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140811/e9d1e44f/attachment-0001.html>


More information about the gstreamer-devel mailing list