[FFmpeg-user] Can't stream using rtsp ... Could not write header for output file #0

Roman Rusconi rrusconi at gmail.com
Fri Sep 25 19:24:18 CEST 2015


Hello.

 

I'm trying to re stream an rtsp stream using ffmpeg.

I have no problem getting the original rtsp stream and write it to a file,
although I can't get ffmpeg to stream this video again using rtsp.

Everything seems fine until the point ffmpeg gets stuck and only stops if I
press CTRL-C, at this point I get an error message saying:

 

"Could not write header for output file #0 (incorrect codec parameters ?):
Immediate exit requested"

 

Here's the command line I'm using :

 

"ffmpeg.exe -v debug -stats -i rtsp://192.168.1.40/rus -vcodec copy -an -f
rtsp -c copy rstp://localhost:554/video"

 

I can't get it to work.

Any ideas what I'm doing wrong?

Here's what I get on screen:

 

 

ffmpeg.exe -v debug -stats -i rtsp://192.168.1.40/rus -vcodec copy -an -f
rtsp -c copy rstp://localhost:554/video

ffmpeg version N-75275-gd13a2df Copyright (c) 2000-2015 the FFmpeg
developers

built with gcc 4.9.3 (GCC)

configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfi

g --enable-frei0r --enable-gnutls --enable-iconv --enable-libass
--enable-libbluray --enable-libbs2b --enable-libcaca --

enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm
--enable-libilbc --enable-libmodplug --enable-libm

p3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp --en

able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora
--enable-libtwolame --enable-libvidstab --ena

ble-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enabl

e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma
--enable-decklink --enable-zlib

libavutil 55. 2.100 / 55. 2.100

libavcodec 57. 1.100 / 57. 1.100

libavformat 57. 0.100 / 57. 0.100

libavdevice 57. 0.100 / 57. 0.100

libavfilter 6. 3.100 / 6. 3.100

libswscale 4. 0.100 / 4. 0.100

libswresample 2. 0.100 / 2. 0.100

libpostproc 54. 0.100 / 54. 0.100

Splitting the commandline.

Reading option '-v' ... matched as option 'v' (set logging level) with
argument 'debug'.

Reading option '-stats' ... matched as option 'stats' (print progress report
during encoding) with argument '1'.

Reading option '-i' ... matched as input file with argument
'rtsp://192.168.1.40/rus'.

Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'copy'

.

Reading option '-an' ... matched as option 'an' (disable audio) with
argument '1'.

Reading option '-f' ... matched as option 'f' (force format) with argument
'rtsp'.

Reading option '-c' ... matched as option 'c' (codec name) with argument
'copy'.

Reading option 'rstp://localhost:554/video' ... matched as output file.

Finished splitting the commandline.

Parsing a group of options: global .

Applying option v (set logging level) with argument debug.

Applying option stats (print progress report during encoding) with argument
1.

Successfully parsed a group of options.

Parsing a group of options: input file rtsp://192.168.1.40/rus.

Successfully parsed a group of options.

Opening an input file: rtsp://192.168.1.40/rus.

[rtsp @ 0000000002fd0b20] SDP:

v=0

o=- 15681997790323947713 15681997790323947713 IN IP4 WIN-KOKF06L712E

s=Unnamed

i=N/A

c=IN IP4 0.0.0.0

t=0 0

a=tool:vlc 2.2.1

a=recvonly

a=type:broadcast

a=charset:UTF-8

a=control:rtsp://192.168.1.40:554/rus

m=video 0 RTP/AVP 96

b=RR:0

a=rtpmap:96 H264/90000

a=fmtp:96
packetization-mode=1;profile-level-id=4d001f;sprop-parameter-sets=Z00AH5pmAo
At/zUBAQFAAAD6AAAw1AE=,aO48gA==;

a=control:rtsp://192.168.1.40:554/rus/trackID=0

 

[rtsp @ 0000000002fd0b20] video codec set to: h264

[rtsp @ 0000000002fd0b20] RTP Packetization Mode: 1

[rtsp @ 0000000002fd0b20] RTP Profile IDC: 4d Profile IOP: 0 Level: 1f

[rtsp @ 0000000002fd0b20] Extradata set to 0000000002fd4ec0 (size: 35)

[udp @ 0000000002fcd8c0] end receive buffer size reported is 65536

[udp @ 0000000002fcd980] end receive buffer size reported is 65536

[rtsp @ 0000000002fd0b20] hello state=0

Failed to parse interval end specification ''

[h264 @ 0000000002fd49a0] Frame num gap 8 5

[h264 @ 0000000002fd49a0] Frame num gap 8 6

[rtsp @ 0000000002fd0b20] All info found

[rtsp @ 0000000002fd0b20] rfps: 24.416667 0.017830

[rtsp @ 0000000002fd0b20] rfps: 24.500000 0.013091

[rtsp @ 0000000002fd0b20] rfps: 24.583333 0.009091

Last message repeated 1 times

[rtsp @ 0000000002fd0b20] rfps: 24.666667 0.005830

[rtsp @ 0000000002fd0b20] rfps: 24.750000 0.003309

Last message repeated 1 times

[rtsp @ 0000000002fd0b20] rfps: 24.833333 0.001527

Last message repeated 1 times

[rtsp @ 0000000002fd0b20] rfps: 24.916667 0.000485

Last message repeated 1 times

[rtsp @ 0000000002fd0b20] rfps: 25.000000 0.000181

Last message repeated 1 times

[rtsp @ 0000000002fd0b20] rfps: 25.083333 0.000618

[rtsp @ 0000000002fd0b20] rfps: 25.166667 0.001793

Last message repeated 1 times

[rtsp @ 0000000002fd0b20] rfps: 25.250000 0.003708

[rtsp @ 0000000002fd0b20] rfps: 25.333333 0.006362

[rtsp @ 0000000002fd0b20] rfps: 25.416667 0.009755

[rtsp @ 0000000002fd0b20] rfps: 25.500000 0.013888

[rtsp @ 0000000002fd0b20] rfps: 25.583333 0.018760

Last message repeated 1 times

[rtsp @ 0000000002fd0b20] rfps: 50.000000 0.000726

Last message repeated 1 times

Input #0, rtsp, from 'rtsp://192.168.1.40/rus':

Metadata:

title : Unnamed

comment : N/A

Duration: N/A, start: 12482.051344, bitrate: N/A

Stream #0:0, 45, 1/90000: Video: h264 (Main), 2 reference frames,
yuv420p(tv, bt709, left), 1280x720, 1/50, 25 fps,

25 tbr, 90k tbn, 50 tbc

Successfully opened the file.

Parsing a group of options: output file rstp://localhost:554/video.

Applying option vcodec (force video codec ('copy' to copy stream)) with
argument copy.

Applying option an (disable audio) with argument 1.

Applying option f (force format) with argument rtsp.

Applying option c (codec name) with argument copy.

Successfully parsed a group of options.

Opening an output file: rstp://localhost:554/video.

Successfully opened the file.

[rtsp @ 00000000066a3900] Codec for stream 0 does not use global headers but
container format requires global headers

 

Received windows signal 0

Output #0, rtsp, to 'rstp://localhost:554/video':

Metadata:

title : Unnamed

comment : N/A

encoder : Lavf57.0.100

Stream #0:0, 0, 1/25: Video: h264, 1 reference frame, yuv420p(left),
1280x720 (0x0), 1/25, q=2-31, 25 fps, 25 tbr, 2

5 tbn, 25 tbc

Stream mapping:

Stream #0:0 -> #0:0 (copy)

Could not write header for output file #0 (incorrect codec parameters ?):
Immediate exit requested

Exiting normally, received signal 2.

 

 

 

 

 

Roman Rusconi

 <mailto:rrusconi at gmail.com> rrusconi at gmail.com

 



More information about the ffmpeg-user mailing list