Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a mp4 file which I wish to compress, resize and stream via RTSP.

My ffserver.conf file looks like this:

Port 9091
RTSPPort 5454
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -

<Feed feed1.ffm> File /tmp/feed1.ffm FileMaxSize 500M </Feed>

<Stream live.mpeg> Format rtp File "/tmp/rtp.mp4" Feed feed1.ffm VideoCodec mpeg2video VideoFrameRate 15 VideoBitRate 200 VideoSize 400x320 #AudioCodec mp2 #AudioBitRate 32 #AudioChannels 2 #AudioSampleRate 22050 NoAudio #Preroll 10 ACL allow </Stream>

<Stream stat.html> Format status # Only allow local people to get the status ACL allow localhost ACL allow </Stream>

From what I understand, I don't need to feed in a video stream using ffmpeg as I am using the File attribute, so ffserver does the work for me?

When I try to use totem to playback the video (ffplay just times-out), I get the following error:

$ totem rtsp://
** Message: Error: Could not read from resource.
gstrtspsrc.c(4408): gst_rtspsrc_send (): /GstPlayBin2:play/GstURIDecodeBin:uridecodebin0/GstRTSPSrc:source:
Got error response: 454 (Session Not Found).

ffserver's log looks like this:

$ ffserver -f /tmp/ffserver.conf 
FFserver version 0.6-4:0.6-2ubuntu6, Copyright (c) 2000-2010 the FFmpeg developers
  built on Oct  5 2010 22:36:53 with gcc 4.4.5
  configuration: --extra-version=4:0.6-2ubuntu6 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  WARNING: library configuration mismatch
  libavutil   configuration: --extra-version=4:0.6-2ubuntu3 --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-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --enable-shared --disable-static
  libavcodec  configuration: --extra-version=4:0.6-2ubuntu3 --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-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --enable-shared --disable-static
  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
Sun Oct 10 12:37:20 2010 FFserver started.
Sun Oct 10 12:38:34 2010 - - [DESCRIBE] "rtsp:// RTSP/1.0" 200 166
Sun Oct 10 12:38:38 2010 - - "PLAY live.mpeg/streamid=0 RTP/UDP"
Sun Oct 10 12:38:38 2010 - - [] " RTP/UDP" 200 0
Sun Oct 10 12:38:43 2010 - - [TEARDOWN] "rtsp:// RTSP/1.0" 200 819
Sun Oct 10 12:38:43 2010 - - "PLAY live.mpeg/streamid=0 RTP/TCP"
Sun Oct 10 12:38:43 2010 - - [] " RTP/TCP" 200 0
Sun Oct 10 12:38:54 2010 - - [PLAY] "rtsp:// RTSP/1.0" 200 621

What am I doing wrong?

share|improve this question
URL_HERE was put in the log as my askubuntu account is new and I am not allowed to add more than a single url in my post. It can be replaced with: rtsp:// – tommed Oct 11 '10 at 12:17
Your question might get a better response from the supperuser site. I recommend migrating it there. – nelaar Jun 10 '11 at 8:38

You can achieve resizing, re-encoding to mpeg2 and RTSP streaming with gstreamer, but I didn't manage to change the frame rate. If this is sufficient, here's how:

  • Install gst RTSP server development package: sudo apt-get install libgstrtspserver-0.10-dev
  • Get a copy of this example launcher
  • Compile it with gcc -o test-launch $(pkg-config --cflags --libs gstreamer-0.10 gst-rtsp-server-0.10) test-launch.c
  • Start streaming: ./test-launch "( filesrc location=/tmp/rtp.mp4 ! decodebin ! videoscale ! video/x-raw-yuv,width=400,height=320 ! ffenc_mpeg2video ! mpegtsmux ! rtpmp2tpay name=pay0 pt=96 )"
  • Watch video: gst-launch-0.10 rtspsrc location=rtsp:// ! decodebin ! xvimagesink

A few caveats:

  • to change the port, you have to add a call to gst_rtsp_server_set_port(server, 9091); in test-launch.c, between lines 44 and 45
  • totem reads the stream, but does not display anything, not even error messages
  • mplayer does not support the stream type
share|improve this answer
Thank you, I will certainly look into using gstreamer. I won't mark this as the answer yet as the original question was to get ffserver working.. hope that sounds fair! :) – tommed Aug 16 '11 at 19:11
I hope you get it working, one way or the other. I deliberately ignored your choice of software as it seemed to me (after some experiments) that there might be mistakes in the ffserver mpeg2 stream parameters that prohibit this from working at all. But I'd like to be shown wrong. – taneli Aug 16 '11 at 20:07

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.