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
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -
NoDaemon
<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 127.0.0.1
</Stream>
<Stream stat.html>
Format status
# Only allow local people to get the status
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255
</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://127.0.0.1:5454/live.mpeg
** 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 127.0.0.1 - - [DESCRIBE] "rtsp://127.0.0.1:5454/live.mpeg RTSP/1.0" 200 166
Sun Oct 10 12:38:38 2010 127.0.0.1:51118 - - "PLAY live.mpeg/streamid=0 RTP/UDP"
Sun Oct 10 12:38:38 2010 127.0.0.1 - - [] " RTP/UDP" 200 0
Sun Oct 10 12:38:43 2010 127.0.0.1 - - [TEARDOWN] "rtsp://127.0.0.1:5454/live.mpeg RTSP/1.0" 200 819
Sun Oct 10 12:38:43 2010 127.0.0.1:0 - - "PLAY live.mpeg/streamid=0 RTP/TCP"
Sun Oct 10 12:38:43 2010 127.0.0.1 - - [] " RTP/TCP" 200 0
Sun Oct 10 12:38:54 2010 127.0.0.1 - - [PLAY] "rtsp://127.0.0.1:5454/live.mpeg RTSP/1.0" 200 621
What am I doing wrong?
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:
sudo apt-get install libgstrtspserver-0.10-dev
gcc -o test-launch $(pkg-config --cflags --libs gstreamer-0.10 gst-rtsp-server-0.10) test-launch.c
./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 )"
gst-launch-0.10 rtspsrc location=rtsp://127.0.0.1:8554/test ! decodebin ! xvimagesink
A few caveats:
gst_rtsp_server_set_port(server, 9091);
in test-launch.c, between lines 44 and 45