Menu

#4 Segfault when changing to H264 (Logitech C920)

next
closed
None
2015-01-10
2013-11-22
Will Price
No

Hi,

I've been trying to get guvcview to work with my logitech C920, however I cannot use the H264 mode. I've tried several versions (the one in the Arch Repos, and have compiled from git), and all present the same bug.

I launch guvcview with guvcview -d /dev/video1, then I go to the video tab and change the capture format. When running with verbose mode I get the following messages:

~~~~~~~
SampleRate:0 Channels:0
Video driver: x11
A window manager is available
(Desktop resolution = 3000x1920)
Checking video mode 1280x720@32bpp : OK
redraw resolution combo for format (34363248)
numb res = 17
setting new resolution (1280 x 720)
cleaning buffer allocations
checking format: H264
(Desktop resolution = 3000x1920)
Checking video mode 1280x720@32bpp : OK
yuv overlay created (1280x720).
stored SPS 37 bytes of data
stored PPS 4 bytes of data
Segmentation fault
~~~~~~~

Discussion

  • Paulo Assis

    Paulo Assis - 2013-11-23

    Hi,
    It looks like guvcview is parsing the IDr frame without problems SPS and PPS seem about the right size. But then it segfaults for some reason.
    Could you run it through valgrind and post me the entire output ?

    Thank you,
    Paulo

     
  • Paulo Assis

    Paulo Assis - 2013-11-23

    If you could also post me some raw frames that would help a lot:
    just uncomment the following lines in v4l2uvc.c:

    //char test_filename[20];
    //snprintf(test_filename, 20, "rawframe-%u.raw", vd->frame_index);
    //SaveBuff (test_filename,vd->buf.bytesused,vd->mem[vd->buf.index]);

    these are in function uvcgrab (line 1555)

    Thank you,
    Paulo

     
  • Paulo Assis

    Paulo Assis - 2013-11-23
    • status: open --> accepted
    • assigned_to: Paulo Assis
    • Milestone: 1.7.0 --> next
     
  • Will Price

    Will Price - 2013-11-23

    Hi Paulo,

    Thanks for your prompt response.

    I've attached the valgrind output, I'll recompile in a minute and give you some raw frames too.

     
  • Will Price

    Will Price - 2013-11-23

    Here are the raw frames

     
  • Paulo Assis

    Paulo Assis - 2013-11-23

    OK,
    So the segfault is caused by libavcodec:

    Invalid read of size 4
    ==18559== at 0x6CA1C3F: av_packet_get_side_data (in /usr/lib/libavcodec.so.55.39.101)
    ==18559== by 0x7032227: avcodec_decode_video2 (in /usr/lib/libavcodec.so.55.39.101)

    I'm currently using libavcodec.so.53.35.0 and it doesn't seem to cause any problems.
    I'll try to upgrade to the latest version and run some tests with it.

    Regards,
    Paulo

     
  • Paulo Assis

    Paulo Assis - 2013-11-23

    Ok so I got this from libav page:

    ---//--

    November 2, 2013

    Today, we update our latest release series 0.8 with the release of Libav 0.8.9. This release contains several security and bug fixes. Among others, several bugs that lead to crashes during playback have been fixed in the H.264 and SVQ3 decoder.

    This release contains many potentially security relevant corrections. For details, please refer to the verbose Changelog file.

    We encourage distributors and system integrators to update, and share their patches against our release branches.

    ----/---

    So apparently the H264 decoder was broken.
    Can you please upgrade your version of libav to the latest one (0.8.9) and test with that.

    Thank you,
    Paulo

     
  • Will Price

    Will Price - 2013-11-26

    Hi,

    I've installed libav and that fixed my problem, guvcview doesn't crash when reading H264 from the camera. I was previously using ffmpeg 2.1.1 instead of libav, is ffmpeg not supported at all?

    Many thanks for all your help :)

     
  • Paulo Assis

    Paulo Assis - 2013-11-26

    Well, there was a big and nasty feud between ffmpeg developers some time back and that caused a split in the project that led to the creation of libav. It's basically a clone of ffmeg, but developers are much more open to fixing bugs and introducing changes, this has made most distros setting libav as the default over ffmpeg.
    That's probably why libav has now fixed the h264 playback issue while ffmpeg is still broken.

    Other from that it should make no difference if you use libav or ffmpeg, they are pretty much the same.

    Regards,
    Paulo

     
  • Paulo Assis

    Paulo Assis - 2013-11-26
    • status: accepted --> closed
     
  • Paulo Assis

    Paulo Assis - 2013-11-26

    Closing this.
    The problem was due to a bug in libavcodec, updating to the latest libav fixes it.

     

Log in to post a comment.