[FFmpeg-user] Problems dumping H264 stream from Axis camera

paulj at fastmail.es paulj at fastmail.es
Fri Aug 24 14:43:14 CEST 2012


>  <paulj <at> fastmail.es> writes:
> 
> > However, yesterday I downloaded the newest git source 
> > and compiled it, and with the new binary I get this error:
> 
> Can you use a tool to dump the stream from the camera to a 
> file and try the same command with the file as input?
> The reason I ask is that if you can provide a file, it is 
> not difficult to find the version introducing the problem 
> and eventually it will get fixed, without a file you will 
> have to use git bisect yourself...
> 


	Okay, I managed to dump the H264 stream out of the camera by using openRTSP 
(from http://www.live555.com/liveMedia). If I use the raw stream file... it DOES work:

[paulo at webserver ~]$ ffmpeg -i video-H264-1 -vcodec copy -acodec copy bla.mp4
ffmpeg version N-43821-gf92f493 Copyright (c) 2000-2012 the FFmpeg developers
  built on Aug 23 2012 12:47:11 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
  libavutil      51. 70.100 / 51. 70.100
  libavcodec     54. 54.100 / 54. 54.100
  libavformat    54. 25.104 / 54. 25.104
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 13.100 /  3. 13.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[h264 @ 0x9a5d500] max_analyze_duration 5000000 reached at 5000000
[h264 @ 0x9a5d500] Estimating duration from bitrate, this may be inaccurate
Input #0, h264, from 'video-H264-1':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuvj420p, 640x480 [SAR 1:1 DAR 4:3], 25 fps, 25 
tbr, 1200k tbn, 50 tbc
Output #0, mp4, to 'bla.mp4':
  Metadata:
    encoder         : Lavf54.25.104
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 640x480 [SAR 1:1 DAR 4:3], 
q=2-31, 25 fps, 1200k tbn, 1200k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  239 fps=0.0 q=-1.0 Lsize=    1442kB time=00:00:09.52 bitrate=1240.6kbits/s    
video:1440kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.122748%


	A further data point: if I use ffmpeg with the "-f h264" option for the output file, it does 
dump it to disk. However, the resulting file is unreadable by any media player, and when 
trying to process it again with ffmpeg, it says "invalid data":


[paulo at webserver ~]$ ffmpeg -rtsp_transport tcp -i rtsp://root:root@192.168.1.129:554/axis-
media/media.amp?streamprofile=Quality?tcp -vcodec copy -acodec copy -t 10 -f h264 
bla.h264
ffmpeg version N-43821-gf92f493 Copyright (c) 2000-2012 the FFmpeg developers
  built on Aug 23 2012 12:47:11 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
  libavutil      51. 70.100 / 51. 70.100
  libavcodec     54. 54.100 / 54. 54.100
  libavformat    54. 25.104 / 54. 25.104
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 13.100 /  3. 13.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rtsp @ 0xa11c5c0] Estimating duration from bitrate, this may be inaccurate
Input #0, rtsp, from 'rtsp://root:root@192.168.1.129:554/axis-
media/media.amp?streamprofile=Quality?tcp':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.094878, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuvj420p, 640x480 [SAR 1:1 DAR 4:3], 30.08 tbr, 
90k tbn, 180k tbc
Output #0, h264, to 'bla.h264':
  Metadata:
    title           : Media Presentation
    encoder         : Lavf54.25.104
    Stream #0:0: Video: h264, yuvj420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 90k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[h264 @ 0xa25f040] pts (0) < dts (1) in stream 0
frame=   42 fps=0.0 q=-1.0 size=     252kB time=00:00:01.99 bitrate=1033.9kbits/frame=   55 
fps= 50 q=-1.0 size=     293kB time=00:00:02.56 bitrate= 937.0kbits/frame=   67 fps= 41 q=-
1.0 size=     386kB time=00:00:03.09 bitrate=1021.0kbits/frame=   80 fps= 38 q=-1.0 size=     
431kB time=00:00:03.59 bitrate= 981.5kbits/frame=   93 fps= 35 q=-1.0 size=     469kB 
time=00:00:04.12 bitrate= 931.1kbits/frame=  107 fps= 34 q=-1.0 size=     573kB 
time=00:00:04.62 bitrate=1014.8kbits/frame=  119 fps= 32 q=-1.0 size=     611kB 
time=00:00:05.15 bitrate= 970.7kbits/frame=  130 fps= 31 q=-1.0 size=     699kB 
time=00:00:05.65 bitrate=1012.4kbits/frame=  145 fps= 31 q=-1.0 size=     753kB 
time=00:00:06.18 bitrate= 996.4kbits/frame=  158 fps= 30 q=-1.0 size=     792kB 
time=00:00:06.71 bitrate= 965.4kbits/frame=  172 fps= 30 q=-1.0 size=     896kB 
time=00:00:07.24 bitrate=1013.0kbits/frame=  184 fps= 29 q=-1.0 size=     932kB 
time=00:00:07.74 bitrate= 985.8kbits/frame=  198 fps= 29 q=-1.0 size=    1033kB 
time=00:00:08.27 bitrate=1021.8kbits/frame=  210 fps= 29 q=-1.0 size=    1072kB 
time=00:00:08.77 bitrate=1000.1kbits/frame=  223 fps= 28 q=-1.0 size=    1111kB 
time=00:00:09.30 bitrate= 977.6kbits/frame=  237 fps= 28 q=-1.0 size=    1218kB 
time=00:00:09.84 bitrate=1013.3kbits/frame=  239 fps= 28 q=-1.0 Lsize=    1225kB 
time=00:00:09.94 bitrate=1008.6kbits/s    
video:1225kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.000000%


	(Notice the "pts (0) < dts (1) in stream 0" warning above. It's what it says before 
giving me the "Invalid argument" error, if I try to read from the camera without the "-f h264").


[paulo at webserver ~]$ ffmpeg -i bla.h264 -vcodec copy -acodec copy bla.mp4
ffmpeg version N-43821-gf92f493 Copyright (c) 2000-2012 the FFmpeg developers
  built on Aug 23 2012 12:47:11 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
  libavutil      51. 70.100 / 51. 70.100
  libavcodec     54. 54.100 / 54. 54.100
  libavformat    54. 25.104 / 54. 25.104
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 13.100 /  3. 13.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
bla.h264: Invalid data found when processing input


	And also, as I mentioned yesterday, using ffplay with the camera works:

[paulo at webserver ~]$ ffplay -rtsp_transport tcp -i rtsp://root:root@192.168.1.129:554/axis-
media/media.amp?streamprofile=Quality?tcp 
ffplay version N-43821-gf92f493 Copyright (c) 2003-2012 the FFmpeg developers
  built on Aug 23 2012 12:47:11 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
  libavutil      51. 70.100 / 51. 70.100
  libavcodec     54. 54.100 / 54. 54.100
  libavformat    54. 25.104 / 54. 25.104
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 13.100 /  3. 13.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rtsp @ 0xa4230e0] Estimating duration from bitrate, this may be inaccurate
Input #0, rtsp, from 'rtsp://root:root@192.168.1.129:554/axis-
media/media.amp?streamprofile=Quality?tcp':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.099878, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuvj420p, 640x480 [SAR 1:1 DAR 4:3], 30 tbr, 90k 
tbn, 180k tbc
Frame changed from size:0x0 to size:640x480B vq=   12KB sq=    0B f=0/0   
   5.32 A-V:  0.000 fd=   0 aq=    0KB vq=   26KB sq=    0B f=0/0   0/0   


	The only thing that doesn't work is using ffmpeg with "-vcodec copy" to write out 
directly the MP4 from the camera.
	So... this is it. Should I send you guys the H264 dump, as per the instructions in the 
ffmpeg.org site?


                                  Paulo.

-------------------------------------------
"Oh, don't worry kids. Most of you will
never fall in love. You'll just marry
for fear of dying alone."

                             The Simpsons.
-------------------------------------------



More information about the ffmpeg-user mailing list