[FFmpeg-user] Problem re-streaming an RTSP stream with ffserver

Jonathan Viney jonathan.viney at gmail.com
Tue Oct 21 07:59:37 CEST 2014


Thanks for the reply. The ffmpeg command is to continuously stream the
camera's rtsp stream into ffserver. Redirecting the stdout of that process
doesn't seem to do much. That SDP output you saw was from the ffmpeg
process streaming the relayed stream via ffserver.

I may have just answered my own question actually. Adding "AVOptionVideo
flags +global_header" to the stream configuration in ffserver.conf seems to
fix the problem.

Oddly, when using rtsp with udp I get a bunch of missed packets:

[NULL @ 0x24ac900] RTP: missed 1 packets
    Last message repeated 19 times

It does seem to affect the output stream, the video is all distorted. This
camera is on the local network, so there shouldn't be drops like this. The
bitrate is around 8000kbits/s. Specifying "-rtsp_transport tcp" when
streaming from ffserver fixes the output file.

Any idea why "-rtsp_transport tcp" is needed when streaming from ffserver,
but not when streaming directly from the camera?

Regards,
-Jonathan.


On Tue, Oct 21, 2014 at 6:45 PM, Maziar Mehrabi <maziar.mehrabi at gmail.com>
wrote:

> Hi,
>
> I think you should save the SDP data into a file and then
> play/capture/transcode using that file.
> ffmpeg -i rtsp://10.9.9.1:554/axis-media/media.amp -c copy
> http://localhost:8090/feed1.ffm > test.sdp
>
> I can see some sdp data printed on your log:
> SDP:
> v=0
> o=- 0 0 IN IP4 127.0.0.1
> s=No Title
> c=IN IP4 0.0.0.0
> t=0 0
> a=tool:libavformat 56.9.101
> m=video 0 RTP/AVP 96
> a=rtpmap:96 H264/90000
> a=fmtp:96 packetization-mode=1
> a=control:streamid=0
>
> and then:
> ffmpeg -loglevel verbose -y -i test.sdp out.mp4
>
> Regards,
> Maziar
>
>
> --
> Hälsningar,
> Maziar Mehrabi,
>
> On Tue, Oct 21, 2014 at 7:21 AM, Jonathan Viney <jonathan.viney at gmail.com>
> wrote:
>
> > Hi,
> >
> > Thanks for all the hard work people do for ffmpeg, it's a fantastic tool
> > :).
> >
> > I am having an issue trying to re-stream an RTSP stream from a camera
> using
> > ffserver - any ideas as to the problem would be much appreciated. I am
> > using the latest git revision of ffmpeg on Ubuntu 14.04.
> >
> > Scenario: RTSP stream coming from IP camera. The stream can be captured
> > easily with ffmpeg and output to a file. I am running ffserver (see
> config
> > below), and passing the stream to ffserver with ffmpeg (see command lines
> > below). This part appears to work fine. However, when I try to capture
> the
> > rtsp stream from ffserver it gives the following errors:
> >
> > [h264 @ 0xbc9ac0] decode_slice_header error
> > [h264 @ 0xbc9ac0] no frame!
> > [h264 @ 0xbc9ac0] non-existing PPS 0 referenced
> >     Last message repeated 1 times
> > [h264 @ 0xbc9ac0] decode_slice_header error
> > [h264 @ 0xbc9ac0] no frame!
> > [rtsp @ 0xbc6f80] interrupted
> > [rtsp @ 0xbc6f80] decoding for stream 0 failed
> > [rtsp @ 0xbc6f80] Could not find codec parameters for stream 0 (Video:
> > h264, none(left)): unspecified size
> > Consider increasing the value for the 'analyzeduration' and 'probesize'
> > options
> > rtsp://localhost:8554/test1.rtsp: could not find codec parameters
> >
> > Here are the details of the setup I am using:
> >
> > Example ffmpeg command line to capture from camera to a file.
> > ffmpeg -i rtsp://10.9.9.1:554/axis-media/media.amp -c copy test1.mp4
> >
> > ffprobe of camera's RTSP stream:
> > ffprobe rtsp://10.9.9.1:554/axis-media/media.amp
> > ffprobe version N-67063-g282c935 Copyright (c) 2007-2014 the FFmpeg
> > developers
> >   built on Oct 21 2014 16:13:26 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
> >   configuration: --enable-shared --enable-pthreads --enable-gpl
> > --enable-version3 --enable-nonfree --enable-vda --enable-libx264
> > --enable-libfaac --enable-libmp3lame --enable-libxvid
> >   libavutil      54. 10.100 / 54. 10.100
> >   libavcodec     56.  8.102 / 56.  8.102
> >   libavformat    56.  9.101 / 56.  9.101
> >   libavdevice    56.  1.100 / 56.  1.100
> >   libavfilter     5.  2.100 /  5.  2.100
> >   libswscale      3.  1.101 /  3.  1.101
> >   libswresample   1.  1.100 /  1.  1.100
> >   libpostproc    53.  3.100 / 53.  3.100
> > Input #0, rtsp, from 'rtsp://10.9.9.1:554/axis-media/media.amp':
> >   Metadata:
> >     title           : Media Presentation
> >   Duration: N/A, start: 0.039989, bitrate: N/A
> >     Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709), 1920x1080 [SAR
> > 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 180k tbc
> >
> > ffserver.conf:
> > HTTPPort 8090
> > HTTPBindAddress 0.0.0.0
> > RTSPPort 8554
> > RTSPBindAddress 0.0.0.0
> > MaxHTTPConnections 2000
> > MaxClients 1000
> > MaxBandwidth 50000
> > CustomLog -
> > <Feed feed1.ffm>
> > File feed1-buffer.ffm
> > FileMaxSize 300M
> > ACL allow 127.0.0.1
> > </Feed>
> > <Stream test1.rtsp>
> >   Feed feed1.ffm
> >   Format rtp
> >   NoAudio
> >   StartSendOnKey
> > </Stream>
> >
> > Command to get ffmpeg to send RTSP stream to ffserver:
> > ffmpeg -i rtsp://10.9.9.1:554/axis-media/media.amp -c copy
> > http://localhost:8090/feed1.ffm
> >
> > Command to capture rtsp stream from ffserver, with errors:
> > ffmpeg -loglevel verbose -y -i rtsp://localhost:8554/test1.rtsp out.mp4
> > ffmpeg version N-67063-g282c935 Copyright (c) 2000-2014 the FFmpeg
> > developers
> >   built on Oct 21 2014 16:13:26 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
> >   configuration: --enable-shared --enable-pthreads --enable-gpl
> > --enable-version3 --enable-nonfree --enable-vda --enable-libx264
> > --enable-libfaac --enable-libmp3lame --enable-libxvid
> >   libavutil      54. 10.100 / 54. 10.100
> >   libavcodec     56.  8.102 / 56.  8.102
> >   libavformat    56.  9.101 / 56.  9.101
> >   libavdevice    56.  1.100 / 56.  1.100
> >   libavfilter     5.  2.100 /  5.  2.100
> >   libswscale      3.  1.101 /  3.  1.101
> >   libswresample   1.  1.100 /  1.  1.100
> >   libpostproc    53.  3.100 / 53.  3.100
> > [rtsp @ 0x23b9c20] SDP:
> > v=0
> > o=- 0 0 IN IP4 127.0.0.1
> > s=No Title
> > c=IN IP4 0.0.0.0
> > t=0 0
> > a=tool:libavformat 56.9.101
> > m=video 0 RTP/AVP 96
> > a=rtpmap:96 H264/90000
> > a=fmtp:96 packetization-mode=1
> > a=control:streamid=0
> >
> > [h264 @ 0x23bc760] non-existing PPS 0 referenced
> >     Last message repeated 1 times
> > [h264 @ 0x23bc760] decode_slice_header error
> > [h264 @ 0x23bc760] no frame!
> > [h264 @ 0x23bc760] non-existing PPS 0 referenced
> >     Last message repeated 1 times
> > [h264 @ 0x23bc760] decode_slice_header error
> > [h264 @ 0x23bc760] no frame!
> > [h264 @ 0x23bc760] non-existing PPS 0 referenced
> >     Last message repeated 1 times
> > [rtsp @ 0x23b9c20] decoding for stream 0 failed
> > [rtsp @ 0x23b9c20] Could not find codec parameters for stream 0 (Video:
> > h264, none): unspecified size
> > Consider increasing the value for the 'analyzeduration' and 'probesize'
> > options
> > rtsp://localhost:8554/test1.rtsp: could not find codec parameters
> > Input #0, rtsp, from 'rtsp://localhost:8554/test1.rtsp':
> >   Metadata:
> >     title           : No Title
> >   Duration: N/A, bitrate: N/A
> >     Stream #0:0: Video: h264, none, 90k tbr, 90k tbn, 180k tbc
> > Output #0, mp4, to 'out.mp4':
> >   Metadata:
> >     title           : No Title
> > Output file #0 does not contain any stream
> > Received signal 2: terminating.
> >
> > Does anyone know why I'm not able to do this successfully? I have tried
> > altering a bunch of settings on the camera, including bring the
> resolution
> > right down to reduce the data rate, and adjusting the analyzeduration and
> > probesize as suggested.
> >
> > I am able to re-stream an RTSP stream from another source successfully
> > (rtsp://live.cdn2.streamago.tv/streamago/34961/28964/). Is there likely
> to
> > be some sort of incompatibility with the stream from the camera?
> >
> > Thanks in advance,
> > -Jonathan.
> > _______________________________________________
> > ffmpeg-user mailing list
> > ffmpeg-user at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>


More information about the ffmpeg-user mailing list