Opened 4 years ago

Last modified 14 months ago

#6832 reopened defect

wrong duration when convert mp4

Reported by: crazymxm Owned by:
Priority: important Component: avformat
Version: git-master Keywords: mov edts duration regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

The output file has the double duration :
Source video duration :00:01:58.88
output video duration :00:03:57.76

(video's duration is double ,audio's duration is correct. So, the video looks like played twice, with no sound in the second half )

./ffmpeg -i /Volumes/LANKEXIN/1383.mp4  out.mp4
ffmpeg version N-82977-g8fd3e02-tessus Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 70.100 / 57. 70.100
  libavformat    57. 61.100 / 57. 61.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/LANKEXIN/1383.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2017-10-30T14:58:05.000000Z
    encoder         : mp4creator 1.6.1d
  Duration: 00:01:58.88, start: 0.000000, bitrate: 1918 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1729 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
    Metadata:
      creation_time   : 2017-10-30T14:58:05.000000Z
      encoder         : VC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2017-10-30T14:58:05.000000Z


The output file :
localhost:Applications maxm$ ./ffmpeg -i /Volumes/LANKEXIN/out.mp4 
ffmpeg version N-82977-g8fd3e02-tessus Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 70.100 / 57. 70.100
  libavformat    57. 61.100 / 57. 61.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/LANKEXIN/out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.61.100
  Duration: 00:03:57.76, start: 0.000000, bitrate: 1825 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1729 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      handler_name    : SoundHandler


Change History (11)

comment:1 by Carl Eugen Hoyos, 4 years ago

Please test current FFmpeg git head and provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

comment:2 by crazymxm, 4 years ago

here is the command line ,and the full log :

./ffmpeg -i /Volumes/LANKEXIN/1383.mp4 out.mp4
ffmpeg version N-82977-g8fd3e02-tessus Copyright (c) 2000-2016 the FFmpeg developers

built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
libavutil 55. 43.100 / 55. 43.100
libavcodec 57. 70.100 / 57. 70.100
libavformat 57. 61.100 / 57. 61.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 68.100 / 6. 68.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/LANKEXIN/1383.mp4':

Metadata:

major_brand : mp42
minor_version : 0
compatible_brands: mp42isom
creation_time : 2017-10-30T14:58:05.000000Z
encoder : mp4creator 1.6.1d

Duration: 00:01:58.88, start: 0.000000, bitrate: 1918 kb/s

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1729 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
Metadata:

creation_time : 2017-10-30T14:58:05.000000Z
encoder : VC Coding

Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:

creation_time : 2017-10-30T14:58:05.000000Z

File 'out.mp4' already exists. Overwrite ? [y/N] y
[libx264 @ 0x7fbaca003c00] using SAR=1/1
[libx264 @ 0x7fbaca003c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fbaca003c00] profile High, level 3.1
[libx264 @ 0x7fbaca003c00] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':

Metadata:

major_brand : mp42
minor_version : 0
compatible_brands: mp42isom
encoder : Lavf57.61.100
Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:

creation_time : 2017-10-30T14:58:05.000000Z
encoder : Lavc57.70.100 libx264

Side data:

cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1

Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:

creation_time : 2017-10-30T14:58:05.000000Z
encoder : Lavc57.70.100 aac

Stream mapping:

Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))

Press [q] to stop, ? for help
frame= 46 fps=0.0 q=0.0 size= 0kB time=00:00:00.93 bitrate= 0.0kbits/sframe= 64 fps= 45 q=28.0 size= 137kB time=00:00:01.66 bitrate= 672.2kbits/frame= 85 fps= 44 qframe= 5944 fps= 33 q=-1.0 Lsize= 38746kB time=00:03:57.64 bitrate=1335.7kbits/s speed=1.33x 4kB time=00:00:02.94 bitrate= 818.0kbits/s speed= 1.2x
video:36779kB audio:1846kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.311413%
[libx264 @ 0x7fbaca003c00] frame I:24 Avg QP:19.49 size: 67090
[libx264 @ 0x7fbaca003c00] frame P:1806 Avg QP:21.65 size: 14304
[libx264 @ 0x7fbaca003c00] frame B:4114 Avg QP:25.42 size: 2484
[libx264 @ 0x7fbaca003c00] consecutive B-frames: 2.2% 8.1% 25.5% 64.2%
[libx264 @ 0x7fbaca003c00] mb I I16..4: 20.6% 55.8% 23.6%
[libx264 @ 0x7fbaca003c00] mb P I16..4: 5.2% 9.3% 0.8% P16..4: 36.0% 9.9% 4.2% 0.0% 0.0% skip:34.5%
[libx264 @ 0x7fbaca003c00] mb B I16..4: 0.5% 1.0% 0.0% B16..8: 27.2% 1.8% 0.2% direct: 0.9% skip:68.5% L0:48.6% L1:47.6% BI: 3.8%
[libx264 @ 0x7fbaca003c00] 8x8 transform intra:60.9% inter:78.2%
[libx264 @ 0x7fbaca003c00] coded y,uvDC,uvAC intra: 38.3% 61.5% 12.3% inter: 6.6% 11.3% 0.6%
[libx264 @ 0x7fbaca003c00] i16 v,h,dc,p: 22% 35% 10% 33%
[libx264 @ 0x7fbaca003c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 24% 21% 5% 6% 6% 6% 5% 6%
[libx264 @ 0x7fbaca003c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 33% 11% 4% 7% 6% 6% 4% 4%
[libx264 @ 0x7fbaca003c00] i8c dc,h,v,p: 43% 30% 20% 7%
[libx264 @ 0x7fbaca003c00] Weighted P-Frames: Y:0.3% UV:0.2%
[libx264 @ 0x7fbaca003c00] ref P L0: 73.5% 9.0% 13.8% 3.7% 0.0%
[libx264 @ 0x7fbaca003c00] ref B L0: 92.4% 6.6% 1.1%
[libx264 @ 0x7fbaca003c00] ref B L1: 97.7% 2.3%
[libx264 @ 0x7fbaca003c00] kb/s:1267.21
[aac @ 0x7fbaca021800] Qavg: 897.576

comment:3 by Carl Eugen Hoyos, 4 years ago

Please test if the issue you see is reproducible with current FFmpeg git head.

comment:4 by crazymxm, 4 years ago

Now, I try the new version (N-89038-g8329ae7-tessus . Before: version N-82977-g8fd3e02-tessus), the problem remains.

Full log


./ffmpeg -i /Volumes/LANKEXIN/1383.mp4 out1.mp4
ffmpeg version N-89038-g8329ae7-tessus Copyright (c) 2000-2017 the FFmpeg developers

built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
libavutil 56. 0.100 / 56. 0.100
libavcodec 58. 3.101 / 58. 3.101
libavformat 58. 2.100 / 58. 2.100
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 0.101 / 7. 0.101
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/LANKEXIN/1383.mp4':

Metadata:

major_brand : mp42
minor_version : 0
compatible_brands: mp42isom
creation_time : 2017-10-30T14:58:05.000000Z
encoder : mp4creator 1.6.1d

Duration: 00:01:58.88, start: 0.000000, bitrate: 1918 kb/s

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1729 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
Metadata:

creation_time : 2017-10-30T14:58:05.000000Z
encoder : VC Coding

Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:

creation_time : 2017-10-30T14:58:05.000000Z

Stream mapping:

Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))

Press [q] to stop, ? for help
[libx264 @ 0x7fb95282f800] using SAR=1/1
[libx264 @ 0x7fb95282f800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fb95282f800] profile High, level 3.1
[libx264 @ 0x7fb95282f800] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out1.mp4':

Metadata:

major_brand : mp42
minor_version : 0
compatible_brands: mp42isom
encoder : Lavf58.2.100
Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:

creation_time : 2017-10-30T14:58:05.000000Z
encoder : Lavc58.3.101 libx264

Side data:

cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1

Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:

creation_time : 2017-10-30T14:58:05.000000Z
encoder : Lavc58.3.101 aac

frame= 5944 fps= 39 q=-1.0 Lsize= 38745kB time=00:03:57.64 bitrate=1335.6kbits/s speed=1.57x
video:36779kB audio:1845kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.311554%
[libx264 @ 0x7fb95282f800] frame I:24 Avg QP:19.49 size: 67090
[libx264 @ 0x7fb95282f800] frame P:1806 Avg QP:21.65 size: 14304
[libx264 @ 0x7fb95282f800] frame B:4114 Avg QP:25.42 size: 2484
[libx264 @ 0x7fb95282f800] consecutive B-frames: 2.2% 8.1% 25.5% 64.2%
[libx264 @ 0x7fb95282f800] mb I I16..4: 20.6% 55.8% 23.6%
[libx264 @ 0x7fb95282f800] mb P I16..4: 5.2% 9.3% 0.8% P16..4: 36.0% 9.9% 4.2% 0.0% 0.0% skip:34.5%
[libx264 @ 0x7fb95282f800] mb B I16..4: 0.5% 1.0% 0.0% B16..8: 27.2% 1.8% 0.2% direct: 0.9% skip:68.5% L0:48.6% L1:47.6% BI: 3.8%
[libx264 @ 0x7fb95282f800] 8x8 transform intra:60.9% inter:78.2%
[libx264 @ 0x7fb95282f800] coded y,uvDC,uvAC intra: 38.3% 61.5% 12.3% inter: 6.6% 11.3% 0.6%
[libx264 @ 0x7fb95282f800] i16 v,h,dc,p: 22% 35% 10% 33%
[libx264 @ 0x7fb95282f800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 24% 21% 5% 6% 6% 6% 5% 6%
[libx264 @ 0x7fb95282f800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 33% 11% 4% 7% 6% 6% 4% 4%
[libx264 @ 0x7fb95282f800] i8c dc,h,v,p: 43% 30% 20% 7%
[libx264 @ 0x7fb95282f800] Weighted P-Frames: Y:0.3% UV:0.2%
[libx264 @ 0x7fb95282f800] ref P L0: 73.5% 9.0% 13.8% 3.7% 0.0%
[libx264 @ 0x7fb95282f800] ref B L0: 92.4% 6.6% 1.1%
[libx264 @ 0x7fb95282f800] ref B L1: 97.7% 2.3%
[libx264 @ 0x7fb95282f800] kb/s:1267.21
[aac @ 0x7fb952831000] Qavg: 826.937

comment:5 by Carl Eugen Hoyos, 4 years ago

Please provide your input file.

in reply to:  5 comment:6 by crazymxm, 4 years ago

Replying to cehoyos:

Please provide your input file.

Here is the input file. Thank you
https://drive.google.com/uc?authuser=0&id=1gYhP272Jrw9FMZ6Y3J6T_BZfWCRZCGln&export=download

comment:7 by Carl Eugen Hoyos, 4 years ago

Component: undeterminedavformat
Keywords: mov edts duration regression added
Priority: normalimportant
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

If there is an issue, it is a regression since ca6cae73db207f17a0d5507609de12842d8f0ca3

comment:8 by galad, 4 years ago

FFmpeg output is correct, that mp4 video track has got two edit list entries, it repeats the same segment of video two times, so the video duration is 3:57.76.

comment:9 by galad, 4 years ago

But the track duration in the tkhd box is not the sum of the edit lists duration, so the file is actually invalid.

comment:10 by vivekyadav, 14 months ago

Resolution: worksforme
Status: openclosed

comment:11 by Carl Eugen Hoyos, 14 months ago

Resolution: worksforme
Status: closedreopened

See #1304.

Note: See TracTickets for help on using tickets.