Opened 6 years ago

Closed 6 years ago

#7186 closed defect (duplicate)

use " -c copy ", but the output's duration and file size doubled

Reported by: 赵俊杰 Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I am trying to copy a mp4 file, use "-c copy" parameter. the input file can be played normally, the duration is 90s, and filesize is 93M;

but, the output file, duration is 180s, file size is 184M; it seems that the video track is repeated.
i can reproduce this problem use the current FFmpeg git head

the sample file url: https://www.datafilehost.com/d/c6b3ff9b

Is there something wrong with the input video?


How to reproduce:

ffmpeg-20180502-e07b191-win64-static\bin\ffmpeg.exe -y -i  headphone_G951_PINK.mp4 -c
 copy copy.mp4
ffmpeg version N-90920-ge07b1913fc Copyright (c) 2000-2018 the FFmpeg developers

  built with gcc 7.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e
nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur
ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab
le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-li
bvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en
able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-
libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl
e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enabl
e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enab
le-dxva2 --enable-avisynth
  libavutil      56. 18.100 / 56. 18.100
  libavcodec     58. 19.100 / 58. 19.100
  libavformat    58. 13.100 / 58. 13.100
  libavdevice    58.  4.100 / 58.  4.100
  libavfilter     7. 21.100 /  7. 21.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'headphone_G951_PINK.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2018-04-22T15:08:18.000000Z
    encoder         : mp4creator 1.6.1d
  Duration: 00:01:31.99, start: 0.000000, bitrate: 8502 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yu
v420p, 1280x720 [SAR 1:1 DAR 16:9], 8376 kb/s, 50 fps, 50 tbr, 90k tbn, 100 tbc
(default)
    Metadata:
      creation_time   : 2018-04-22T15:08:18.000000Z
      encoder         : VC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, flt
p, 130 kb/s (default)
    Metadata:
      creation_time   : 2018-04-22T15:08:18.000000Z
Output #0, mp4, to 'copy.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    encoder         : Lavf58.13.100
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yu
v420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 8376 kb/s, 50 fps, 50 tbr, 90k tbn,
90k tbc (default)
    Metadata:
      creation_time   : 2018-04-22T15:08:18.000000Z
      encoder         : VC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, flt
p, 130 kb/s (default)
    Metadata:
      creation_time   : 2018-04-22T15:08:18.000000Z
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 000000cb820f33c0] Packet with invalid duration -8269200 in stream 0
frame= 9190 fps=0.0 q=-1.0 Lsize=  189512kB time=00:03:03.78 bitrate=8447.5kbits
/s speed= 619x
video:187951kB audio:1461kB subtitle:0kB other streams:0kB global headers:0kB mu
xing overhead: 0.052934%

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

Change History (4)

comment:1 by 赵俊杰, 6 years ago

another sample file url:  
        https://www.datafilehost.com/d/bf1d611b

if the first url is invalid, try this one.
thanks very much!

comment:2 by mkver, 6 years ago

Your video has two edit list entries each of which says that the whole video should be played from the beginning to the end; your audio has no edit list. ffmpeg honours these edit lists when it demuxes the file and that explains what you have experienced. This is actually a complete duplicate of #6832 (including the fact that the file is actually invalid because the duration in the media header box for the video track is not the sum of the durations of the entries of the edit lists).
You can use the ignore_editlist argument for the mp4 demuxer. Unfortunately the muxer creating this file seems to be dead so files like these will continue to be created.
(Btw: the most recent version of MKVToolNix (23.0) has a workaround for broken files like these so that the video isn't duplicated with it any more.)

in reply to:  2 comment:3 by 赵俊杰, 6 years ago

Replying to mkver:

Your video has two edit list entries each of which says that the whole video should be played from the beginning to the end; your audio has no edit list. ffmpeg honours these edit lists when it demuxes the file and that explains what you have experienced. This is actually a complete duplicate of #6832 (including the fact that the file is actually invalid because the duration in the media header box for the video track is not the sum of the durations of the entries of the edit lists).
You can use the ignore_editlist argument for the mp4 demuxer. Unfortunately the muxer creating this file seems to be dead so files like these will continue to be created.
(Btw: the most recent version of MKVToolNix (23.0) has a workaround for broken files like these so that the video isn't duplicated with it any more.)

Thank you very much!!

comment:4 by Carl Eugen Hoyos, 6 years ago

Priority: importantnormal
Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.