Opened 4 years ago

Last modified 3 years ago

#2307 new defect

Stream segmenter bug if total recorded length > 12 hours

Reported by: dgillier Owned by:
Priority: normal Component: undetermined
Version: 1.1.3 Keywords: segment, duration
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I'm recording UDP streams with transcoding to disk.
UDP source are MPEGTS stream with MPEG2 encoding (TV channels).

I'm transcoding and recording in H264 using 30 minutes chunks. After the #24 segment is recorded (so after 12 hours of recording) the audio duration info is wrong in the file (look like a signed vs unsigned variable problem).

Here is what I'm doing :
ffmpeg -i udp://xx.xx.xx.xx:5000 -map 0:0 -map 0:1 -s 640x360 -vcodec libx264 -g 60 -vb 500000 -strict experimental -vf yadif -acodec aac -ab 96000 -ac 2 -y -f segment -segment_format mp4 -segment_time 1800 /mnt/%03dt.mp4

I tried to change the audio codec to libvo_aacenc with the same result.
So it seems to be related to the segmenter.

Here is a copy of the ffmpeg dump when I inspect the file:
Correct files (segment 0 to 24):

[root@srv1 ~]# ffmpeg -i /mnt/video/www/2013-01-25/tf1/tf1-024.mp4
ffmpeg version 1.1 Copyright (c) 2000-2013 the FFmpeg developers

built on Jan 12 2013 16:56:27 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-version3
libavutil 52. 13.100 / 52. 13.100
libavcodec 54. 86.100 / 54. 86.100
libavformat 54. 59.106 / 54. 59.106
libavdevice 54. 3.102 / 54. 3.102
libavfilter 3. 32.100 / 3. 32.100
libswscale 2. 1.103 / 2. 1.103
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3156500] Invalid SampleDelta? in STTS -2073690672
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/video/www/2013-01-25/tf1/tf1-024.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.59.106

Duration: 00:30:00.32, start: 0.000000, bitrate: 662 kb/s

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 560 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
Metadata:

handler_name : VideoHandler?

Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 kb/s
Metadata:

handler_name : SoundHandler?

At least one output file must be specified


Bad files (segment #25 and more)
[root@srv1 ~]# ffmpeg -i /mnt/026.mp4
ffmpeg version 1.1 Copyright (c) 2000-2013 the FFmpeg developers

built on Jan 12 2013 16:56:27 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-version3
libavutil 52. 13.100 / 52. 13.100
libavcodec 54. 86.100 / 54. 86.100
libavformat 54. 59.106 / 54. 59.106
libavdevice 54. 3.102 / 54. 3.102
libavfilter 3. 32.100 / 3. 32.100
libswscale 2. 1.103 / 2. 1.103
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/video/www/2013-01-25/tf1/tf1-026.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.59.106

Duration: 12:21:15.64, start: 0.000000, bitrate: 22 kb/s

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 455 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
Metadata:

handler_name : VideoHandler?

Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 3 kb/s
Metadata:

handler_name : SoundHandler?

At least one output file must be specified

Any clue on this ?
Thanks.
Denis

Change History (23)

comment:1 Changed 4 years ago by cehoyos

  • Component changed from FFmpeg to undetermined

Is this problem also reproducible with current git head?

Is this problem only reproducible with udp input or also with (for example) "ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero" ?

comment:2 follow-up: Changed 4 years ago by dgillier

I'm going to try with the git head...

regarding URL input, I don't haves file longer than 12 hours, I will create one.

I'm sorry but I don't understand what ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero should do ?

BTW , I forgot to notice the fact that in problematic files the audio rate is wrong : Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 3 kb/s

Also the file play correctly, but you cannot navigate in it...

comment:3 in reply to: ↑ 2 Changed 4 years ago by cehoyos

Replying to dgillier:

I'm sorry but I don't understand what ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero should do ?

It provides input both to produce a file longer than 12 hours and to test the segmenter directly.

comment:4 follow-up: Changed 4 years ago by dgillier

I successfully created a 13 hours file from the same command line using the same UDP source.
It really seems to be related to the segmenter.

BTW ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero output was not readable...

comment:5 in reply to: ↑ 4 Changed 4 years ago by cehoyos

Replying to dgillier:

BTW ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero output was not readable...

Could you elaborate?
The command works fine here and if it is sufficient to reproduce the problem, it may be easier to fix.

comment:6 Changed 4 years ago by cehoyos

It works fine here, could you test current git head (or 1.2)?

$ ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero -vcodec mpeg4 -strict -2 -acodec aac -f segment -segment_time 1800 -map 0 -map 1 out%3d.mp4
ffmpeg version N-50974-g7d15cd4 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 16 2013 10:10:06 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libx264
  libavutil      52. 19.100 / 52. 19.100
  libavcodec     55.  0.100 / 55.  0.100
  libavformat    55.  0.100 / 55.  0.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 45.104 /  3. 45.104
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[lavfi @ 0x2e57780] Estimating duration from bitrate, this may be inaccurate
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
[s16le @ 0x2e5a300] max_analyze_duration 5000000 reached at 5015510 microseconds
[s16le @ 0x2e5a300] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #1.0 : mono
Input #1, s16le, from '/dev/zero':
  Duration: N/A, bitrate: 705 kb/s
    Stream #1:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Output #0, segment, to 'out%3d.mp4':
  Metadata:
    encoder         : Lavf55.0.100
    Stream #0:0: Video: mpeg4, yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 25 tbc
    Stream #0:1: Audio: aac, 44100 Hz, mono, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> mpeg4)
  Stream #1:0 -> #0:1 (pcm_s16le -> aac)
Press [q] to stop, [?] for help
frame=2340088 fps=430 q=10.2 Lsize=N/A time=26:00:03.52 bitrate=N/A    
video:2285549kB audio:15977kB subtitle:0 global headers:0kB muxing overhead -100.000001%
$ ffmpeg -i out024.mp4 
ffmpeg version N-50974-g7d15cd4 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 16 2013 10:10:06 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libx264
  libavutil      52. 19.100 / 52. 19.100
  libavcodec     55.  0.100 / 55.  0.100
  libavformat    55.  0.100 / 55.  0.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 45.104 /  3. 45.104
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out024.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf55.0.100
  Duration: 00:30:00.01, start: 43200.000000, bitrate: 206 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 200 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 1 kb/s
    Metadata:
      handler_name    : SoundHandler
At least one output file must be specified
$ ffmpeg -i out025.mp4 
ffmpeg version N-50974-g7d15cd4 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 16 2013 10:10:06 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libx264
  libavutil      52. 19.100 / 52. 19.100
  libavcodec     55.  0.100 / 55.  0.100
  libavformat    55.  0.100 / 55.  0.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 45.104 /  3. 45.104
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out025.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf55.0.100
  Duration: 00:30:00.00, start: 45000.000000, bitrate: 206 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 199 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 1 kb/s
    Metadata:
      handler_name    : SoundHandler
At least one output file must be specified

comment:7 Changed 4 years ago by dgillier

Just installed 1.2 and same problem:

ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers

built on Mar 19 2013 14:57:52 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-version3
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/video/www/2013-03-20/tf1/tf1-025.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.63.104

Duration: 12:51:18.78, start: 0.000000, bitrate: 21 kb/s

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 491 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
Metadata:

handler_name : VideoHandler?

Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s
Metadata:

handler_name : SoundHandler?

At least one output file must be specified
<<

(BTW your test is encoded in mpeg4 not h264).

Can I use ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero on a headless server ?
When I tested it, the file was unreadable...
Thanks, denis

comment:8 Changed 4 years ago by cehoyos

Could you test if you can reproduce the problem without using an external library, ie is it also reproducible if you test with "-vcodec mpeg4" ?

comment:9 follow-up: Changed 4 years ago by dgillier

Ok I'll do it.

BTW your files have on your ffmpeg dump:

stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 1 kb/s

instead of 128kb/s (don't know if it's related, but I have same problem on my corrupted files).

comment:10 in reply to: ↑ 9 Changed 4 years ago by cehoyos

Replying to dgillier:

BTW your files have on your ffmpeg dump:

stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 1 kb/s

instead of 128kb/s (don't know if it's related,

What's wrong with 1kb for aac-encoded silence?

comment:11 Changed 4 years ago by dgillier

Check the 020 or any previous file and you will have a much higher data rate (that has nothing to do with silence...).

It seems that the problem is a bit more tricky.

The .mp4 file generated by the segmenter are not correct. They don't have the correct header in place.
The file 0.mp4 is readable, but all the others are not, for a reason I don't know..
VLC and other are displaying a black screen with no audio.

If with the initial segmented files you add a ffmpeg -i segmentfiles-xxx.mp4 -c copy -y newfile-xxx.mp4, afterward, the new files are correct and readable.
But all the files after the 024 one, have false length data.

comment:12 Changed 4 years ago by cehoyos

Can you reproduce this when using testsrc?

comment:13 Changed 4 years ago by cehoyos

Additionally: Is the problem only reproducible if you encode audio and video, or also with -an ?

comment:14 follow-up: Changed 4 years ago by dgillier

I tried this evening with testsrc and I got strange behavior:

Command used was :
ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero -vcodec mpeg4 -vb 400000 -strict -2 -acodec aac -f segment -segment_time 1800 -map 0 -map 1 /mnt/video/tests/test-mp4-%03dt.mp4

I got a file per minute instead of a file per 30 minutes (1800 seconds), but I have in the description of the file (true for all files), a 30 minutes duration ???:

ffmpeg -i /mnt/video/tests/test-mp4-998t.mp4
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers

built on Mar 19 2013 15:08:09 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-version3
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/video/tests/test-mp4-998t.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf54.63.104

Duration: 00:30:00.00, start: 1796400.000000, bitrate: 406 kb/s

Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 399 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc
Metadata:

handler_name : VideoHandler?

Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 1 kb/s
Metadata:

handler_name : SoundHandler?

I'm going to test with -an

Thanks,
Denis

comment:15 in reply to: ↑ 14 Changed 4 years ago by cehoyos

Replying to dgillier:

I tried this evening with testsrc and I got strange behavior:

Command used was :
ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero -vcodec mpeg4 -vb 400000 -strict -2 -acodec aac -f segment -segment_time 1800 -map 0 -map 1 /mnt/video/tests/test-mp4-%03dt.mp4

I got a file per minute instead of a file per 30 minutes (1800 seconds), but I have in the description of the file (true for all files), a 30 minutes duration ???:

Sorry, I don't understand, I tested the following command line:
$ ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero -vcodec mpeg4 -vb 400000 -strict -2 -acodec aac -f segment -segment_time 1800 -map 0 -map 1 outsegment-%03d.mp4

I did not wait until 1000 files were written, but tested a few output files and they were all 30 minutes long (definitely not one minute) and that is also what your "ffmpeg -i"-output shows.

comment:16 follow-up: Changed 4 years ago by dgillier

The problem with $ ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero -vcodec mpeg4 -vb 400000 -strict -2 -acodec aac -f segment -segment_time 1800 -map 0 -map 1 outsegment-%03d.mp4 is that it is supposed to create a segment every 1800 seconds (30min) and in fact it creates one every 60 seconds. And the result files are declared of having 30min lenght (but actually recorded 1min of content)...

Anyway my point is not on using testsrc...

I tested with no audio as you requested.
Result is a bit different but still not ok.

As with audio, segmented .mp4 files are not readable after the first segment.
You need to do a ffmpeg -i xxxt.mp4 -c copy xxx.mp4 pass to get headers.
VLC read the file (30 minutes of video) but with no time line..

And here is the result off ffmpeg (a 0s duration file):
ffmpeg -i /mnt/video/tests/recopie.mp4
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers

built on Mar 19 2013 15:08:09 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-version3
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3188a20] Invalid SampleDelta? in STTS -599050752
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/video/tests/recopie.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf54.63.104

Duration: 00:00:00.00, start: 0.000000, bitrate: N/A

Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 400 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc
Metadata:

handler_name : VideoHandler?

At least one output file must be specified

Tks.
Denis

comment:17 in reply to: ↑ 16 Changed 4 years ago by cehoyos

Replying to dgillier:

The problem with $ ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero -vcodec mpeg4 -vb 400000 -strict -2 -acodec aac -f segment -segment_time 1800 -map 0 -map 1 outsegment-%03d.mp4 is that it is supposed to create a segment every 1800 seconds (30min) and in fact it creates one every 60 seconds. And the result files are declared of having 30min lenght (but actually recorded 1min of content)...

Which application are you using to test? I only tested ffplay and MPlayer, but I cannot imagine an application that would play these 30min samples in one minute.

Or do you really mean you are unhappy that it took FFmpeg only one minute (on your hardware) to encode a 30 minute file? The reason I ask is that I assume your original report (using udp) will take many hours to reproduce and I have the feeling that most developers will refuse to wait so long that is why I suggested to test with a file (it is already difficult enough to encode 25 - or twelve - hours with a file as input but easier than via udp) and with -i testsrc.

Anyway my point is not on using testsrc...

The point is to find out how to reproduce the problem without using udp (or huge files) or clarify that it cannot be reproduced with testsrc.

I tested with no audio as you requested.
Result is a bit different but still not ok.

As with audio, segmented .mp4 files are not readable after the first segment.

Is this the issue you originally reported or a different one? Iirc, originally only the 25th segment was incorrect or did I misunderstand?

comment:18 Changed 4 years ago by dgillier

Ok, sorry I did not understand what testsrc is. So forget my comment on this.

My understanding is that the segmenter don't create correct .mp4 segment, as they not readable by any player as is.
I get correct (but perhaps they are not) .mp4 files by adding a ffmepg - in.mp4 -c copy -out.mp4 file second pass to the segmented files.

The problem is, after the 24th -30min- segment file, the declared duration is wrong (negative) and you cannot navigate in the file.

When I applied the same process (because the segmented .mp4 file are not readable) with video only files, the files duration is 0s.
So yes it is basically the same problem, wrong duration (negative one for files with audio, 0 duration for file with just video)...

comment:19 Changed 4 years ago by cehoyos

Is the problem (or problems of which you believe they are the same) reproducible if you use testsrc as input? If yes, please provide the command line together with complete, uncut console output.

comment:20 Changed 4 years ago by dgillier

Here is the result with one of the testsrc input file (not h264):

[root@srv4 ~]# ffmpeg -i /mnt/video/tests/test-mp4-979t.mp4
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers

built on Mar 19 2013 15:08:09 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-version3
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/video/tests/test-mp4-979t.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf54.63.104

Duration: 00:30:00.00, start: 1762200.000000, bitrate: 406 kb/s

Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 400 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc
Metadata:

handler_name : VideoHandler?

Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 1 kb/s
Metadata:

handler_name : SoundHandler?

At least one output file must be specified
[root@srv4 ~]#

With the second pass :

ffmpeg -i /mnt/video/tests/test-mp4-979t.mp4 -c copy /mnt/video/tests/test-979.mp4
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers

built on Mar 19 2013 15:08:09 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-version3
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/video/tests/test-mp4-979t.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf54.63.104

Duration: 00:30:00.00, start: 1762200.000000, bitrate: 406 kb/s

Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 400 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc
Metadata:

handler_name : VideoHandler?

Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 1 kb/s
Metadata:

handler_name : SoundHandler?

Output #0, mp4, to '/mnt/video/tests/test-979.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf54.63.104
Stream #0:0(und): Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 400 kb/s, 25 fps, 12800 tbn, 12800 tbc
Metadata:

handler_name : VideoHandler?

Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, mono, 1 kb/s
Metadata:

handler_name : SoundHandler?

Stream mapping:

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

Press [q] to stop, ? for help
frame=45000 fps=30603 q=-1.0 Lsize= 89365kB time=00:30:00.00 bitrate= 406.7kbits/s
video:87919kB audio:308kB subtitle:0 global headers:0kB muxing overhead 1.290589%
[root@srv4 ~]#

Result :

[root@srv4 ~]# ffmpeg -i /mnt/video/tests/test-979.mp4
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers

built on Mar 19 2013 15:08:09 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-version3
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3140a20] Invalid SampleDelta? in STTS -1081323008
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3140a20] Invalid SampleDelta? in STTS -403608574
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/video/tests/test-979.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf54.63.104

Duration: 00:00:00.00, start: 0.000000, bitrate: N/A

Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 400 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc
Metadata:

handler_name : VideoHandler?

Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 1 kb/s
Metadata:

handler_name : SoundHandler?

At least one output file must be specified
[root@srv4 ~]#

comment:21 Changed 4 years ago by cehoyos

(I meant the command line to produce the broken files.)

The duration is shown correctly afaict or do I misunderstand?
Is the problem only reproducible with the 979th file or also with an earlier one (I don't mean 978)?

comment:22 follow-up: Changed 4 years ago by dgillier

Command line use with testsrc :
ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero -s 640x360 -vcodec mpeg4 -g 60 -vb 400000 -strict -2 -acodec aac -f segment -segment_time 1800 -map 0 -map 1 /mnt/video/tests/test-mp4-%03dt.mp4

Command line used in production:
ffmpeg -i $MPEGTS_URL_UDP -map 0:0 -map 0:1 -s 640x360 -vcodec libx264 -g 60 -vb 500000 -strict experimental -vf yadif -acodec aac -ab 96000 -ac 2 -y -f segment -segment_format mp4 -segment_time 1800 /mnt/video/$STATION-%03dt.mp4

Duration is correct from testsrc, but with the one I use I cannot read the segmented file, I added the second pass :
ffmpeg -i test-mp4-979t.mp4 -c copy test-979.mp4.
And after this one duration file are incorrect.

With testsrc it is the same on all files. With UDP source it happens only after the 024.

comment:23 in reply to: ↑ 22 Changed 3 years ago by cehoyos

Sorry, I still don't understand the problem and hoped that somebody else would have a look.

Replying to dgillier:

Command line use with testsrc :
ffmpeg -f lavfi -i testsrc -f s16le -i /dev/zero -s 640x360 -vcodec mpeg4 -g 60 -vb 400000 -strict -2 -acodec aac -f segment -segment_time 1800 -map 0 -map 1 /mnt/video/tests/test-mp4-%03dt.mp4

With testsrc it is the same on all files. With UDP source it happens only after the 024.

Does that mean that with testsrc, it is not necessary to encode 24 files but one is sufficient?

Note: See TracTickets for help on using tickets.