Opened 23 months ago

Closed 22 months ago

Last modified 22 months ago

#5847 closed defect (duplicate)

Duration estimate and bitrate calculation wrong when file is over 4Gb

Reported by: petere Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: mpegps
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
When I concatenate vob files the duration is estimated correctly up to 4Gb then after this the duration and bitrate is wrong.
How to reproduce:

% Correct, file size is 3,919,550,464 bytes containing vobs 1-4
G:\DVD Rip\BATMAN_BEGINS_DISC_1\VIDEO_TS>c:\work\mezzmo\build\current\ffmpeg64\ffmpeg.exe -i g:\batmanbegins-concat.vob
ffmpeg version N-78742-gf477849 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-memalign-hack --arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --enable-static --disable-shared --enable-zlib --disable-postproc --prefix=/home/peter/ffmpeg/build/gpl64 --enable-libmp3lame --enable-libx264 --enable-gpl --extra-libs='-lx264 -lpthread -lstdc++' --enable-runtime-cpudetect --extra-cflags=-I/home/peter/cc32/include --extra-ldflags=-L/home/peter/cc64/lib --pkg-config=pkg-config --pkg-config-flags=--static --disable-w32threads --enable-libvpx --enable-libvorbis --enable-libtheora --enable-libx265 --enable-libmfx --enable-gnutls --extra-libs='-lz -lnettle -lhogweed -lgmp -lidn -lws2_32 -lcrypt32'
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 25.101 / 57. 25.101
  libavformat    57. 26.100 / 57. 26.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 36.100 /  6. 36.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
Input #0, mpeg, from 'g:\batmanbegins-concat.vob':
  Duration: 01:16:33.61, start: 0.045622, bitrate: 6826 kb/s
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 8000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2[0x81]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:3[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
At least one output file must be specified

Incorrect, file size is 4,993,290,240 bytes containing vobs 1-5
G:\DVD Rip\BATMAN_BEGINS_DISC_1\VIDEO_TS>C:\Users\petere\Downloads\ffmpeg-20160915-6f062eb-win32-static\ffmpeg-20160915-6f062eb-win32-static\bin\ffmpeg.exe -i g:\batmanbegins-concat.vob
ffmpeg version N-81664-g6f062eb Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 55.101 / 57. 55.101
  libavformat    57. 49.100 / 57. 49.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 62.100 /  6. 62.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mpeg, from 'g:\batmanbegins-concat.vob':
  Duration: 00:20:23.88, start: 0.045622, bitrate: 32639 kb/s
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2[0x81]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:3[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
At least one output file must be specified

Happens with any concatenated vob over 4Gb, just use a file concat tool to merge the vobs.

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (11)

comment:1 Changed 22 months ago by cehoyos

  • Keywords mpegps added

Please test the following command lines on your system to verify your analysis:

$ ffmpeg -f lavfi -i testsrc=pal -target dvd -fs 5G out5.vob
$ ffmpeg -i out5.vob

comment:2 Changed 22 months ago by petere

When ffmpeg encodes a single large vob file it is fine but if I take VTS_01_1.vob and combine it with VTS_01_2.vob, VTS_01_3.vob, VTS_01_4.vob and VTS_01_5.vob using a file concatenation outside of ffmpeg then use ffmpeg to try to read the duration it is wrong. If I call ffmpeg -i on any of the vobs separately the duration and bitrate is correct. It seems to only be an issue when using several vobs combined together.

ffmpeg is reading from the start and end of the file so possibly it is reading the pts and a rollover is occuring.

Last edited 22 months ago by petere (previous) (diff)

comment:3 Changed 22 months ago by richardpl

  • Resolution set to invalid
  • Status changed from new to closed

How are this supposed to work at all if you use dumb concatenation tool?

Closing as invalid.

comment:4 Changed 22 months ago by cehoyos

  • Resolution changed from invalid to duplicate

I believe this is a duplicate of ticket #2084, feel free to test the following:

$ ffmpeg -probesize 5G -analyzeduration 10G -i g:\batmanbegins-concat.vob

comment:5 Changed 22 months ago by petere

I am trying to use -ss to start segmenting from a point in the file but if the duration is not correctly calculated it does not work. I can take vobs 4, 5 and 6 and concatenate them and feed them into ffmpeg and it gets the correct bitrate and duration but if I have 123456 vobs it does not work. Debug output shows:

Non-increasing DTS in stream 0: packet 12 with DTS 9223090561878065151, packet 15 with DTS 340323626

so this looks like it is rolling over.

Last edited 22 months ago by petere (previous) (diff)

comment:6 Changed 22 months ago by cehoyos

Did you test with analyzeduration?

comment:7 Changed 22 months ago by petere

Yes I tested with analyzeduration and it took a long time but still did not get the correct duration or bitrate. Upon further investigation it looks like the timestamps reset in vob 5 so the duration is correct in vobs 1, 2, 3, and 4 but 5 starts at 0 again. So if ffmpeg reads the timestamps from the end of the file they will be less than the start and the duration and bitrate will be incorrect.

I tried using the separate vobs and the concat: input but this does not use analyzeduration so it does not find all the subtitles when I use filter complex to burn subtitles.

comment:8 Changed 22 months ago by richardpl

Why not try concat demuxer instead?

comment:9 Changed 22 months ago by petere

I tried concat demuxer but it does not support analyzeduration so it does not find the subtitle streams when burning subtitles with complex filter

comment:10 Changed 22 months ago by richardpl

What command you tried with concat demuxer?

comment:11 Changed 22 months ago by petere

ffmpeg -analyzeduration 120000000 -probesize 100M -i "concat:G:\DVD Rip\BATMAN_BEGINS_DISC_1\VIDEO_TS\vts_01_1.vob|G:\DVD Rip\BATMAN_BEGINS_DISC_1\VIDEO_TS\vts_01_2.vob|G:\DVD Rip\BATMAN_BEGINS_DISC_1\VIDEO_TS\vts_01_3.vob|G:\DVD Rip\BATMAN_BEGINS_DISC_1\VIDEO_TS\vts_01_4.vob|G:\DVD Rip\BATMAN_BEGINS_DISC_1\VIDEO_TS\vts_01_5.vob|G:\DVD Rip\BATMAN_BEGINS_DISC_1\VIDEO_TS\vts_01_6.vob|G:\DVD Rip\BATMAN_BEGINS_DISC_1\VIDEO_TS\vts_01_7.vob"

This gives the correct duration but does not find the subtitles.

Note: See TracTickets for help on using tickets.