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
~~~~~~~
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
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
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.
Here are the raw frames
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
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
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 :)
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
Closing this.
The problem was due to a bug in libavcodec, updating to the latest libav fixes it.