Incorrect durations mp4 file created by ffmpeg (avconv)

Posted by Ruslan Sharipov on Server Fault See other posts from Server Fault or by Ruslan Sharipov
Published on 2012-06-29T08:20:10Z Indexed on 2012/06/29 9:17 UTC
Read the original article Hit count: 244

Filed under:
|
|
|
|

Example usage:

avconv -i rtmp://maps.lo.ufanet.ru/live/10e227922b473e91f37474fa084107af
-vcodec copy -an -sn -map 0 -f segment -segment_format mp4 -segment_time 60 -y
%05d.mp4
avconv version 0.8.3-6:0.8.3-1+b1, Copyright (c) 2000-2012 the Libav developers
  built on Jun 15 2012 13:54:35 with gcc 4.7.0
HandShake: client signature does not match!
Metadata:
  height                480.00
remote_addr:
  sdp_session           {sdp_session,0,
             {sdp_o,"-","1289703354974145","1289703354974145",inet4,
                    "10.1.12.99"},
             "Media Presentation",
             {inet4,"0.0.0.0"},
             {0,0},
             [{"control","*"},{"range","npt=0.0
  start                 30400239.52
  timeshift_duration    319250.58
  timeshift_size        120000.00
  width                 640.00
[flv @ 0x1d36a40] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from
'rtmp://maps.lo.ufanet.ru/live/10e227922b473e91f37474fa084107af':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: h264 (Baseline), yuvj420p, 640x480 [PAR 1:1 DAR 4:3],
1k tbr, 1k tbn, 2k tbc
Output #0, segment, to '%05d.mp4':
  Metadata:
    encoder         : Lavf53.21.0
    Stream #0.0: Video: libx264, yuvj420p, 640x480 [PAR 1:1 DAR 4:3], q=2-31,
1k tbn, 1k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press ctrl-c to stop encoding
^Cframe= 9566 fps= 36 q=-1.0 Lsize=      -0kB time=318.25 bitrate=  -0.0kbits/s 
video:30348kB audio:0kB global headers:0kB muxing overhead -100.000071%
Received signal 2: terminating.

Result:

serafim@yard:~/video2$ ls
00000.mp4  00001.mp4  00002.mp4  00003.mp4  00004.mp4  00005.mp4

Now try to play the files in the player, such as VLC. And that's what we get: the first fragment (00000.mp4) played well, no problems, but the second (00001.mp4 and beyond) starts the bug manifests itself, namely the file 00001.mp4 first 60 seconds black screen, but since 61 seconds starts playing the video.

Attachments: https://dl.dropbox.com/u/760901/rtmp_and_mp4.zip

How to get rid of the delay with black screen at the beginning of the segments? Maybe ffmpeg to pass parameters, or third-party software is able to correct the obtained segments mp4?

© Server Fault or respective owner

Related posts about linux

Related posts about streaming