Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Having a problem running ffmpeg to an ffserver in a brand new install of Xubuntu 12.10.

I just installed Xubuntu 12.10 from scratch, then installed ffmpeg. I plugged in my webcam (mind you I have used this webcam on another system Ubuntu 12.04 and 11.04 without any problems using the same ffserver and same command) then ran the ffmpeg command:

ffmpeg -f video4linux2 -i /dev/video0 http://IP:8090/cam1.ffm

Now in theory that should work but what I get is:

fmpeg version 0.8.4-6:0.8.4-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers
  built on Nov  6 2012 16:49:20 with gcc 4.7.2
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
ffmpeg: /build/buildd/libav-0.8.4/libavutil/mathematics.c:79: av_rescale_rnd: Assertion `c > 0' failed.
Aborted (core dumped)

I have searched that error and cannot find it anywhere. So I tried mplayer to see if the webcam was working and if video0 was working:

mplayer tv:// -tv device=/dev/video0:driver=v4l2:width=352:height=288

That works perfectly and shows me my webcam screen.

Now I thought, ok maybe this stupid deprecation thing has something to do with it, so I tried the exact same command for ffmpeg using avconv and I get the same error.

lsusb gives me:

Bus 001 Device 003: ID 04fc:1528 Sunplus Technology Co., Ltd SPCA1527A/SPCA1528 SD card camera (webcam mode)

As I said, I have this exact same webcam working on two other PC's with two different Ubuntu installs.

EDIT:

I've recompiled ffmpeg using these instructions: https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide

It works, if I just use the same command as above it runs, CPU runs at 100% as if it was converting. But no output in ffmpeg, it just hangs here indefinitely until I ctrl-c:

ffmpeg version git-2013-01-01-fde1305 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  1 2013 11:42:21 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1)
  configuration: --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 85.100 / 54. 85.100
  libavformat    54. 58.102 / 54. 58.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 30.102 /  3. 30.102
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[video4linux2,v4l2 @ 0x97c8200] DTS discontinuity in stream 0: packet 3 with DTS 21527529506, packet 4 with DTS 21527577460

Then once I ctrl-c twice I get this:

^CEstimating duration from bitrate, this may be inaccurate
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 21527.513483, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p, 320x240, -2147483 kb/s, 18.08 tbr, 1000k tbn, 1000k tbc
http://IP:8090/cam1.ffm: Input/output error
Received signal 2: terminating.

Ok, let me see if I specify framerate what happens:

ffmpeg -r 2 -f video4linux2 -i /dev/video0 http://IP:8090/cam1.ffm

ffmpeg version git-2013-01-01-fde1305 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  1 2013 11:42:21 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1)
  configuration: --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 85.100 / 54. 85.100
  libavformat    54. 58.102 / 54. 58.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 30.102 /  3. 30.102
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[video4linux2,v4l2 @ 0xa5fa2a0] DTS discontinuity in stream 0: packet 3 with DTS 21627329870, packet 4 with DTS 21627409821
[video4linux2,v4l2 @ 0xa5fa2a0] max_analyze_duration 5000000 reached at 5000000
[video4linux2,v4l2 @ 0xa5fa2a0] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 21627.313851, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p, 320x240, 0 kb/s, 2 fps, 0.25 tbr, 1000k tbn, 2 tbc
Incompatible pixel format '(null)' for codec 'flv', auto-selecting format '(null)'
    Last message repeated 1 times
[flv @ 0xa6046c0] Specified pixel format yuvj420p is invalid or not supported
Output #0, ffm, to 'http://198.144.186.224:8090/cam1.ffm':
  Metadata:
    creation_time   : now
    Stream #0:0: Video: flv1 ([0][0][0][5] / 0x5000000), yuvj420p, 320x2, q=255-255, 200 kb/s, 1000k tbn, 2 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> flv)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

My ffserver conf file looks like this (even though as I said it was working before from another PC):

Port 8090
BindAddress IP
MaxHTTPConnections 30
MaxClients 20
MaxBandwidth 2000
CustomLog - 

<Feed cam1.ffm> 
File /tmp/cam1.ffm
FileMaxSize 10000K
</Feed> 

<Stream cam1.flv> 
Feed cam1.ffm 
Format flv 
VideoCodec flv 
VideoFrameRate 2
VideoBufferSize 20000 
VideoBitRate 200 
VideoQMin 5
VideoQMax 10 
VideoSize qvga
PreRoll 0 
Noaudio 
AVOptionVideo flags +global_header
</Stream>

<Stream stat.html>
Format status
</Stream>

EDIT 2:

Just confirmed that running it on my Ubuntu 11.04 machine it works just fine, the command is a bit different but it works:

ffmpeg -r 10 -s 320x240 -f video4linux2 -aspect 4:3 -i /dev/video0 http://IP:8090/cam1.ffm

So I copied this command into the other Xubuntu system and I get the missing yuvj420p problem from before:

[video4linux2,v4l2 @ 0xb1c53e0] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 27867.321194, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p, 320x240, -1 kb/s, 10 tbr, 1000k tbn, 10 tbc
Incompatible pixel format '(null)' for codec 'flv', auto-selecting format '(null)'
    Last message repeated 1 times
[flv @ 0xb1ca6e0] Specified pixel format yuvj420p is invalid or not supported
Output #0, ffm, to 'http://198.144.186.224:8090/cam1.ffm':
  Metadata:
    creation_time   : now
    Stream #0:0: Video: flv1 ([0][0][0][5] / 0x5000000), yuvj420p, 320x10, q=255-255, 200 kb/s, 1000k tbn, 10 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> flv)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Above is posted the config information when I run ffmpeg on my Xubuntu machine, here is what is displayed when I run ffmpeg on my Ubuntu 11 machine:

FFmpeg version 0.6.6-4:0.6.6-0ubuntu0.11.04.1, Copyright (c) 2000-2010 the Libav developers
  built on Jun 12 2012 16:28:21 with gcc 4.5.2
  configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  WARNING: library configuration mismatch
  libavutil   configuration: --extra-version=4:0.6.6-1ubuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libavcodec  configuration: --extra-version=4:0.6.6-1ubuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libavformat configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libavdevice configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libavfilter configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libswscale  configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libpostproc configuration: --extra-version=4:0.6.6-0ubuntu0.11.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0

So of course it's compiled with different options, but which option is the one that supports yuvj420p or how do I get the error for that to go away now that I know what the problem "seems" to be?

EDIT 3:

I recompiled using my switches from my working Ubuntu 11 system:

./configure --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame   --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora   --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 --enable-shared --enable-libv4l2 --enable-avfilter --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-pthreads --enable-zlib --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-libdc1394 --disable-static

The --enable-shared is supposed to be yuvj subsets.

So that's done and all switches, now I run it and get:

[video4linux2,v4l2 @ 0x9d1d0e0] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 36365.493926, bitrate: 36863 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x480, 36863 kb/s, 10 tbr, 1000k tbn, 10 tbc
Incompatible pixel format '(null)' for codec 'flv', auto-selecting format '(null)'
    Last message repeated 1 times
[flv @ 0x9d22440] Warning min_rate > 0 but min_rate != max_rate isn't recommended!
[flv @ 0x9d22440] bitrate below min bitrate
Output #0, ffm, to 'http://IP:8090/cam1.ffm':
  Metadata:
    creation_time   : now
    Stream #0:0: Video: flv1 ([0][0][0][5] / 0x5000000), yuv420p, 640x10, q=255-255, 200 kb/s, 1000k tbn, 10 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> flv)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

So now it runs and finds things but still won't let me because of bitrate below min bitrate. I have tried setting -b 200k and -b 600k but still same thing. I figure it's because the FFM file states 200, but I want it at 200.

So now how do I disable bitrate checking?

I guess that's the problem now, to be honest I'm tempted to install Ubuntu 11.04 on this system and scratch it, each new version of software makes things harder and harder.

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.