id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc	blockedby	blocking	reproduced	analyzed
1734	Problems dumping H264 stream from an Axis camera	PaulJBis		"I'm trying to dump the H264 stream from an Axis M-1011 camera, and latest ffmpeg gives me a ""av_interleaved_write_frame(): Invalid argument"" error.

The stream does work if I play it using ffplay. If I dump the raw stream with openRTSP (from http://www.live555.com/liveMedia) and then feed it to ffmpeg, it does work too. It only stops working if I use ffmpeg to receive directly the stream (so unfortunately I can't provide you with any video samples).

Using git bisect, I managed to narrow down the revision where the bug started happening: version 2107009 is the last one that worked, while 3e1cf49 (and subsequent ones) don't work. Following a discussion in the mailing list, I tried removing ""&& has_decode_delay_been_guessed(st)"" from compute_pkt_fields() in libavformat/utils.c, in the current version, and it started working too.

Below are console outputs, including command lines:

Output of the current version:
{{{
[paulo@webserver ffmpeg]$ ./ffmpeg -v 9 -loglevel 99 -rtsp_transport tcp -i rtsp://root:root@192.168.1.131:554/axis-media/media.amp?streamprofile=Media?tcp -vcodec copy -acodec copy -t 4 ../axis.mp4
ffmpeg version N-44400-g2de8877 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 12 2012 22:25:21 with gcc 4.1.2 (GCC) 20080704 (Red Hat 4.1.2-50)
  configuration: --enable-encoder=libx264 --enable-libx264 --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib
  libavutil      51. 72.100 / 51. 72.100
  libavcodec     54. 55.100 / 54. 55.100
  libavformat    54. 26.101 / 54. 26.101
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 16.103 /  3. 16.103
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rtsp @ 0xa6d85e0] SDP:
v=0
o=- 1288182959680264 1288182959680264 IN IP4 192.168.1.131
s=Media Presentation
e=NONE
c=IN IP4 0.0.0.0
b=AS:50000
t=0 0
a=control:rtsp://192.168.1.131:554/axis-media/media.amp?streamprofile=Media?tcp
a=range:npt=0.000000-
m=video 0 RTP/AVP 96
b=AS:50000
a=framerate:25.0
a=transform:1,0,0;0,1,0;0,0,1
a=control:rtsp://192.168.1.131:554/axis-media/media.amp/trackID=1?streamprofile=Media?tcp
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; profile-level-id=420029; sprop-parameter-sets=Z0IAKeNQFAe2AtwEBAaQeJEV,aM48gA==

[rtsp @ 0xa6d85e0] video codec set to: h264
[NULL @ 0xa6e07c0] RTP Packetization Mode: 1
[NULL @ 0xa6e07c0] RTP Profile IDC: 42 Profile IOP: 0 Level: 29
[NULL @ 0xa6e07c0] Extradata set to 0xa6e0c40 (size: 30)!
[rtsp @ 0xa6d85e0] hello state=0
[rtsp @ 0xa6d85e0] All info found
rfps: 29.500000 0.016870
rfps: 29.583333 0.012762
rfps: 29.666667 0.009299
rfps: 29.750000 0.006483
rfps: 29.833333 0.004314
    Last message repeated 1 times
rfps: 29.916667 0.002791
    Last message repeated 1 times
rfps: 30.000000 0.001914
    Last message repeated 1 times
rfps: 30.083333 0.001684
rfps: 30.166667 0.002100
    Last message repeated 1 times
rfps: 30.250000 0.003163
    Last message repeated 1 times
rfps: 30.333333 0.004872
    Last message repeated 1 times
rfps: 30.416667 0.007228
rfps: 30.500000 0.010230
rfps: 30.583333 0.013878
rfps: 30.666667 0.018173
rfps: 59.666667 0.017255
rfps: 59.750000 0.013886
rfps: 59.833333 0.011163
rfps: 59.916667 0.009087
    Last message repeated 1 times
rfps: 60.000000 0.007657
    Last message repeated 1 times
rfps: 29.970030 0.002155
    Last message repeated 1 times
rfps: 59.940060 0.008620
    Last message repeated 1 times
[rtsp @ 0xa6d85e0] Estimating duration from bitrate, this may be inaccurate
Input #0, rtsp, from 'rtsp://root:root@192.168.1.131:554/axis-media/media.amp?streamprofile=Media?tcp':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.099867, bitrate: N/A
    Stream #0:0, 28, 1/90000: Video: h264 (Baseline), yuvj420p, 640x480 [SAR 1:1 DAR 4:3], 1/180000, 30.08 tbr, 90k tbn, 180k tbc
Output #0, mp4, to '../axis.mp4':
  Metadata:
    title           : Media Presentation
    encoder         : Lavf54.26.101
    Stream #0:0, 0, 1/90000: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 640x480 [SAR 1:1 DAR 4:3], 1/90000, q=2-31, 90k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0xa8125e0] pts (0) < dts (1) in stream 0
av_interleaved_write_frame(): Invalid argument
}}}

Output of version 2107009 (last one that worked):

{{{
[paulo@webserver ffmpeg]$ ./ffmpeg -v 9 -loglevel 99 -rtsp_transport tcp -i rtsp://root:root@192.168.1.131:554/axis-media/media.amp?streamprofile=Media?tcp -vcodec copy -acodec copy -t 4 ../axis.mp4
ffmpeg version N-43195-g2107009 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 14 2012 14:26:23 with gcc 4.1.2 (GCC) 20080704 (Red Hat 4.1.2-50)
  configuration: --enable-encoder=libx264 --enable-libx264 --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib
  libavutil      51. 66.100 / 51. 66.100
  libavcodec     54. 48.100 / 54. 48.100
  libavformat    54. 22.100 / 54. 22.100
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3.  5.102 /  3.  5.102
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rtsp @ 0xa0df5c0] SDP:
v=0
o=- 1288183655668567 1288183655668567 IN IP4 192.168.1.131
s=Media Presentation
e=NONE
c=IN IP4 0.0.0.0
b=AS:50000
t=0 0
a=control:rtsp://192.168.1.131:554/axis-media/media.amp?streamprofile=Media?tcp
a=range:npt=0.000000-
m=video 0 RTP/AVP 96
b=AS:50000
a=framerate:25.0
a=transform:1,0,0;0,1,0;0,0,1
a=control:rtsp://192.168.1.131:554/axis-media/media.amp/trackID=1?streamprofile=Media?tcp
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; profile-level-id=420029; sprop-parameter-sets=Z0IAKeNQFAe2AtwEBAaQeJEV,aM48gA==

[rtsp @ 0xa0df5c0] video codec set to: h264
[NULL @ 0xa0e7760] RTP Packetization Mode: 1
[NULL @ 0xa0e7760] RTP Profile IDC: 42 Profile IOP: 0 Level: 29
[NULL @ 0xa0e7760] Extradata set to 0xa0e7c40 (size: 30)!
[rtsp @ 0xa0df5c0] hello state=0
[rtsp @ 0xa0df5c0] All info found
rfps: 29.666667 0.017957
rfps: 29.750000 0.011154
    Last message repeated 1 times
rfps: 29.833333 0.006086
    Last message repeated 1 times
rfps: 29.916667 0.002752
    Last message repeated 1 times
rfps: 30.000000 0.001154
rfps: 30.083333 0.001291
rfps: 30.166667 0.003162
    Last message repeated 1 times
rfps: 30.250000 0.006769
    Last message repeated 1 times
rfps: 30.333333 0.012110
    Last message repeated 1 times
rfps: 30.416667 0.019187
rfps: 59.750000 0.016809
rfps: 59.833333 0.011010
    Last message repeated 1 times
rfps: 59.916667 0.006945
    Last message repeated 1 times
rfps: 60.000000 0.004616
rfps: 29.970030 0.001529
    Last message repeated 1 times
rfps: 59.940060 0.006116
    Last message repeated 1 times
[rtsp @ 0xa0df5c0] Estimating duration from bitrate, this may be inaccurate
Input #0, rtsp, from 'rtsp://root:root@192.168.1.131:554/axis-media/media.amp?streamprofile=Media?tcp':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.099856, bitrate: N/A
    Stream #0:0, 22, 1/90000: Video: h264 (Baseline), yuvj420p, 640x480 [SAR 1:1 DAR 4:3], 1/180000, 30 tbr, 90k tbn, 180k tbc
Output #0, mp4, to '../axis.mp4':
  Metadata:
    title           : Media Presentation
    encoder         : Lavf54.22.100
    Stream #0:0, 0, 1/90000: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 640x480 [SAR 1:1 DAR 4:3], 1/90000, q=2-31, 90k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=   38 fps=0.0 q=-1.0 size=     347kB time=00:00:01.82 bitrate=1554.8kbits/
frame=   50 fps= 47 q=-1.0 size=     434kB time=00:00:02.36 bitrate=1507.2kbits/
frame=   62 fps= 40 q=-1.0 size=     520kB time=00:00:02.85 bitrate=1490.0kbits/
frame=   75 fps= 36 q=-1.0 size=     652kB time=00:00:03.39 bitrate=1574.2kbits/
frame=   88 fps= 34 q=-1.0 size=     744kB time=00:00:03.89 bitrate=1567.0kbits/
No more output streams to write to, finishing.
frame=   91 fps= 32 q=-1.0 Lsize=     767kB time=00:00:03.98 bitrate=1575.8kbits/s    
video:766kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.236722%
}}}
"	defect	closed	important	avformat	git-master	fixed	regression h264 rtp axis				0	0
