Opened 5 years ago

Last modified 5 years ago

#2333 new defect

mkv + ac3 remux adds a little time

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

Description

ffmpeg adds time to the muxed mkv and demuxed mkv:

ffmpeg version N-50025-gb8bb661 Copyright (c) 2000-2013 the FFmpeg developers

built on Feb 17 2013 02:37:45 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 17.101 / 52. 17.101
libavcodec 54. 91.103 / 54. 91.103
libavformat 54. 63.100 / 54. 63.100
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 38.100 / 3. 38.100
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

ffmpeg -i input.mkv -i input.ac3 -map 0:0 -map 1:0 -vcodec copy -acodec copy -y done.mkv

Input #0, matroska,webm, from 'input.mkv':

Duration: 00:00:12.85, start: 0.000000, bitrate: 6039 kb/s

Input #0, ac3, from 'input.ac3':

Duration: 00:00:12.86, start: 0.000000, bitrate: 256 kb/s

Input #0, matroska,webm, from 'done.mkv':

Metadata:

ENCODER : Lavf54.63.100

Duration: 00:00:12.93, start: 0.000000, bitrate: 6256 kb/s

ffmpeg -i done.mkv -an -vcodec copy -y demux.mkv

ffmpeg -i done.mkv -acodec copy -vn -y demux.ac3

Input #0, matroska,webm, from 'demux.mkv':

Metadata:

ENCODER : Lavf54.63.100

Duration: 00:00:12.91, start: 0.000000, bitrate: 6008 kb/s

Input #0, ac3, from 'demux.ac3':

Duration: 00:00:12.86, start: 0.000000, bitrate: 256 kb/s

Change History (7)

comment:1 follow-ups: Changed 5 years ago by cehoyos

To make this a valid ticket, please provide your failing command line including complete, unedited console output and please consider using a "Code block".

comment:2 in reply to: ↑ 1 Changed 5 years ago by Squeeto

Replying to cehoyos:

To make this a valid ticket, please provide your failing command line including complete, unedited console output and please consider using a "Code block".

Please note the Duration discrepancies:

ffmpeg -i input.mkv -i input.ac3 -map 0:0 -map 1:0 -vcodec copy -acodec copy -y done.mkv

ffmpeg version N-50025-gb8bb661 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 17 2013 02:37:45 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.103 / 54. 91.103
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.100 /  3. 38.100
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, matroska,webm, from 'input.mkv':
  Duration: 00:00:12.85, start: 0.000000, bitrate: 6039 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x1080, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 20k tbn, 59.94 tbc (default)
[ac3 @ 025ad320] max_analyze_duration 5000000 reached at 5024000 microseconds
[ac3 @ 025ad320] Estimating duration from bitrate, this may be inaccurate
Input #1, ac3, from 'input.ac3':
  Duration: 00:00:12.86, start: 0.000000, bitrate: 256 kb/s
    Stream #1:0: Audio: ac3, 48000 Hz, stereo, fltp, 256 kb/s
Output #0, matroska, to 'done.mkv':
  Metadata:
    encoder         : Lavf54.63.100
    Stream #0:0(eng): Video: h264 (H264 / 0x34363248), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 1k tbn, 20k tbc (default)
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, 256 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  385 fps=0.0 q=-1.0 Lsize=    9876kB time=00:00:12.86 bitrate=6289.3kbits/s    
video:9468kB audio:402kB subtitle:0 global headers:0kB muxing overhead 0.065323%

ffmpeg -i done.mkv -an -vcodec copy -y demux.mkv

ffmpeg version N-50025-gb8bb661 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 17 2013 02:37:45 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.103 / 54. 91.103
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.100 /  3. 38.100
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, matroska,webm, from 'done.mkv':
  Metadata:
    ENCODER         : Lavf54.63.100
  Duration: 00:00:12.93, start: 0.000000, bitrate: 6256 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x1080, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 256 kb/s
Output #0, matroska, to 'demux.mkv':
  Metadata:
    encoder         : Lavf54.63.100
    Stream #0:0(eng): Video: h264 (H264 / 0x34363248), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 1k tbn, 1k tbc (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  385 fps=0.0 q=-1.0 Lsize=    9471kB time=00:00:12.81 bitrate=6055.1kbits/s    
video:9468kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.038442%

ffmpeg -i done.mkv -acodec copy -vn -y demux.ac3

ffmpeg version N-50025-gb8bb661 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 17 2013 02:37:45 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.103 / 54. 91.103
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.100 /  3. 38.100
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, matroska,webm, from 'done.mkv':
  Metadata:
    ENCODER         : Lavf54.63.100
  Duration: 00:00:12.93, start: 0.000000, bitrate: 6256 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x1080, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 256 kb/s
Output #0, ac3, to 'demux.ac3':
  Metadata:
    encoder         : Lavf54.63.100
    Stream #0:0: Audio: ac3, 48000 Hz, stereo, 256 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=     402kB time=00:00:12.93 bitrate= 254.7kbits/s    
video:0kB audio:402kB subtitle:0 global headers:0kB muxing overhead 0.000000%

ffmpeg -i demux.mkv

ffmpeg version N-50025-gb8bb661 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 17 2013 02:37:45 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.103 / 54. 91.103
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.100 /  3. 38.100
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, matroska,webm, from 'demux.mkv':
  Metadata:
    ENCODER         : Lavf54.63.100
  Duration: 00:00:12.91, start: 0.000000, bitrate: 6008 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x1080, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
At least one output file must be specified

ffmpeg -i demux.ac3

ffmpeg version N-50025-gb8bb661 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 17 2013 02:37:45 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.103 / 54. 91.103
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.100 /  3. 38.100
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[ac3 @ 0226b420] max_analyze_duration 5000000 reached at 5024000 microseconds
[ac3 @ 0226b420] Estimating duration from bitrate, this may be inaccurate
Input #0, ac3, from 'demux.ac3':
  Duration: 00:00:12.86, start: 0.000000, bitrate: 256 kb/s
    Stream #0:0: Audio: ac3, 48000 Hz, stereo, fltp, 256 kb/s
At least one output file must be specified

comment:3 Changed 5 years ago by Squeeto

Has my question been properly requested?
It has been a week so I am not sure if you are still waiting.

Recap:

input.mkv              12.85 sec
input.ac3              12.86
done.mkv (ffmpeg copy) 12.93
demux.mkv              12.91
demux.ac3              12.86

comment:4 Changed 5 years ago by cehoyos

If I understand correctly, you fear that remuxing makes your audio files longer. The only way to prove this is to decode both the original file and the remuxed file to wav files and compare them.

Or do I misunderstand the issue?

comment:5 in reply to: ↑ 1 Changed 5 years ago by Squeeto

I started this question at http://ffmpeg.zeranoe.com/forum; it was there that the demuxed times were asked for trouble-shooting purposes.

I only want to mux the input.mkv and input.ac3. I would prefer to use ffmpeg but I noticed that mkvmerge makes a done.mkv of 12.86 seconds. Why does ffmpeg add a little time? Does it matter? Can I still splice together done.mkv, done2.mkv, done3.mkv, etc. and expect doneTotal.mkv to be okay?

I am not concerned that input.ac3 is a little longer than input.mkv.

Thank you

comment:6 Changed 5 years ago by Squeeto

Hi again.
I found this branch of ffmpeg called ffmbc that creates an output mkv file of 12.86 seconds as I am hoping for.

ffmpeg -i done_ffmbc.mkv

ffmpeg version N-50025-gb8bb661 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 17 2013 02:37:45 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.103 / 54. 91.103
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 38.100 /  3. 38.100
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, matroska,webm, from 'done_ffmbc.mkv':
  Metadata:
    ENCODER         : FFmbc 0.7
  Duration: 00:00:12.86, start: 0.000000, bitrate: 6289 kb/s
    Stream #0:0: Video: h264 (High), yuv420p, 1920x1080, SAR 1:1 DAR 16:9, 20k fps, 20k tbr, 1k tbn, 59.94 tbc (default)
    Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 256 kb/s (default)
At least one output file must be specified

comment:7 Changed 5 years ago by rogerdpack

maybe it's rounding up or something, when reporting time back to the container?

Note: See TracTickets for help on using tickets.