Axis M3114 h264 on ffmpeg ubuntu 12.04

Forum for questions and support relating to the 1.25.x releases only.
Locked
cambot
Posts: 14
Joined: Mon Apr 23, 2012 5:15 pm

Axis M3114 h264 on ffmpeg ubuntu 12.04

Post by cambot »

Hi there! Long time lurker, first time poster!

I've had Zoneminder running on my cameras grabbing static images for a long time now; I finally decided to get h264 working to see if I could reduce my network bandwidth.

However, I've noticed I have a problem with three of my cameras, which are all Axis M3114 domes. I have a small Axis M1011 which streams h264 through ffmpeg just fine. I think it's a compatibility issue between ffmpeg and the Axis M3114 specifically.

What works:
- vlc going to Axis M1011 and Axis M3114
- ffplay going to Axis M1011
- zoneminer going to Axis M1011

What doesn't work:
- ffplay going to Axis M3114

ffplay going to my Axis M3114 seems to work for maybe 10-15 seconds before I get a stream error, then the stream stops playing. If I restart ffplay it continues to work for another 10-15 seconds. Zoneminder shows the same issue; I get Signal errors whenever this happens.

I've tried playing with the camera settings; trying lower resolution, going from Variable bit rate to Constant Bit rate, lowering the bandwidth etc.

So I have a couple of questions for anyone who might have some input:

1. Anyone else out there with the Axis M3114 notice this behavior too?
2. Is there a way to use vlc to capture the camera output? I thought maybe I could use the "file" method of capturing a stream from a specific program but I'm not sure how to set that up.

I'm running Zoneminder 1.25.0 on the beta of ubuntu 12.04, aka precise pangolin. I've tested this on both 32-bit and 64-bit systems and the behavior is identical. I'm able to wipe and re-install these boxes from scratch (I've already done it many times to test earlier versions of ubuntu) so if anyone wants me to try some experiments I'm game.

Thanks for reading!
cambot
Posts: 14
Joined: Mon Apr 23, 2012 5:15 pm

Re: Axis M3114 h264 on ffmpeg ubuntu 12.04

Post by cambot »

I finally figured it out, after much installing and re-installing. :)

Short answer is: you need the Original ffmpeg, NOT libav. The two are not going to play well together on your box at once (I tried, had all kinds of library conflicts trying to run a separate copy for Zoneminder while leaving libav in place for the rest of the system). So my solution assumes you are only going to use your box for Zoneminder.

Here's the version I installed that ended up working (output of ffmpeg -version):

Code: Select all

ffmpeg version 0.10.2-4:0.10.2-0ubuntu0jon1
built on Mar 18 2012 10:01:10 with gcc 4.6.3
configuration: --extra-version='4:0.10.2-0ubuntu0jon1' --arch=i386 --prefix=/usr --libdir=/usr/lib/i386-linux-gnu --disable-stripping --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libfreetype --enable-vaapi --enable-frei0r --enable-gpl --enable-postproc --enable-x11grab --enable-librtmp --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --shlibdir=/usr/lib/i386-linux-gnu --enable-shared --disable-static
libavutil      51. 35.100 / 51. 35.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. 61.100
libswscale      2.  1.100 /  2.  1.100
libswresample   0.  6.100 /  0.  6.100
libpostproc    52.  0.100 / 52.  0.100
FFMPEG_INPUT_OPTIONS needs to be set to:

Code: Select all

-rtsp_flags filter_src -an
FFMPEG_OUTPUT_OPTIONS is blanked out completely.

On the camera side, you can run variable bit rate or constant bit rate encoding. I set the GOV length to be 20.

The important thing to note is that this ubuntu no longer uses the original ffmpeg. Apparently the ffmpeg developers disagreed on how to proceed at some point, so a group of them forked the ffmpeg development path and started libav. Libav is what ubuntu has decided to use going forward; unfortunately the latest version of libav does not work with the h264 data that the Axis M3114 produces. It might someday, but for now I had to do the following:

1. Install ubuntu-server 12.04 from a cd. I used the 32-bit version. Configure networking and the only service I chose on install is OpenSSH server. Leave everything else blank.

2. Once your server is up run, add the ffmpeg ppa from Jon Severinsson

Code: Select all

apt-get install python-software-properties
add-apt-repository ppa:jon-severinsson/ffmpeg
apt-get update
apt-get install -V ffmpeg
3. Install zoneminder package:

Code: Select all

apt-get install zoneminder
The rest of zoneminder configuration is up to you. However, I did notice that there is a bug in the zoneminder package which causes errors in the logs to show up that look like this:

Code: Select all

zmwatch[2429].ERR [Shared data size conflict in shared_data for monitor Monitor-1, expected 328, got 316]
To make these go away, I had to edit /usr/share/perl5/ZoneMinder/Memory.pm and replace the line that looks like this:

Code: Select all

$arch = int(3.2*length(~0));
with this:

Code: Select all

$arch = 32;
I'm guessing this only works on 32-bit systems, so if you're installing this on a 64-bit box I have no idea whether setting this to 64 is correct or not.

Anyway, I hope this helps someone else in the far future who has to deal with this camera and happens to find this post!
Locked