Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#8456 closed defect (invalid)

Copy codec doubles duration of video stream

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

Description

Copy codec doubles video stream (audio stream is OK):
How to reproduce:

% ffmpeg -i Bubble_burst.mp4 -c copy Bubble.mp4

ffmpeg version: git-2020-01-02-81172b5
built on Windows 7 64-bit (Zeranoe's build)

FFprobe for input and output files:

>ffprobe -hide_banner Bubble_burst.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Bubble_burst.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    encoder         : mp4creator 1.6.1d
  Duration: 00:00:06.33, start: 0.000000, bitrate: 556 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 376x360 [SAR 1:1 DAR 47:45], 554 kb/s, 15 fps, 15
 tbr, 90k tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2020-01-04T18:54:36.000000Z
      encoder         : VC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 24000 Hz, stereo, fltp, 2 kb/s (default)
    Metadata:
      creation_time   : 2020-01-04T18:54:36.000000Z

>ffprobe -hide_banner Bubble.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Bubble.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.35.101
  Duration: 00:00:12.67, start: 0.000000, bitrate: 555 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 376x360 [SAR 1:1 DAR 47:45], 554 kb/s, 15 fps, 15
 tbr, 90k tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 24000 Hz, stereo, fltp, 2 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

Attachments (1)

Bubble_burst.mp4 (430.4 KB ) - added by MarianD 4 years ago.
Input file

Download all attachments as: .zip

Change History (9)

by MarianD, 4 years ago

Attachment: Bubble_burst.mp4 added

Input file

comment:1 by Carl Eugen Hoyos, 4 years ago

Component: ffmpegundetermined
Keywords: copy muxer demuxer removed
Resolution: worksforme
Status: newclosed

Both input and output file play for over 12 seconds here.

in reply to:  1 comment:2 by Balling, 4 years ago

Resolution: worksforme
Status: closedreopened

Replying to cehoyos:

Both input and output file play for over 12 seconds here.

Both VLC and MPC play it only for 1 time for 6 second. Only ffplay plays it twice. Interesting.
Does h264 (Constrained Baseline) have repetition flags?

in reply to:  1 comment:3 by Gyan, 4 years ago

Resolution: invalid
Status: reopenedclosed

Replying to cehoyos:

Both input and output file play for over 12 seconds here.

Then the duration shown by ffmpeg for the input is wrong.

To the OP, in the file header, the edit list for the track indicates that the stream should be repeated once.

track[0].edit_count = 2
duration=570000 time=0 rate=1.000000
Last message repeated 1 times

But the header appears to be malformed, since I am unable to dump the relevant boxes for the input due to an inconsistency in an earlier part of the header, which triggers an assertion failure.

To ignore this editlist and get the expected length, use

ffmpeg -ignore_editlist 1 -i Bubble_burst.mp4 -c copy Bubble.mp4

comment:4 by Gyan, 4 years ago

Summary: Copy codec doubles video streamCopy codec doubles duration of video stream

comment:5 by mkver, 4 years ago

Summary: Copy codec doubles duration of video streamCopy codec doubles video stream

The video stream in this file has an edit list that says that the video should be displayed twice. So actually looping the video is the correct behaviour. But I think the file is actually invalid, as the duration of the track in the tkhd and the mdhd box both shows 6s, although it is double that after applying the edit list.

mkvmerge has a workaround for this kind of file (see here and here). I don't have a strong opinion on whether such a workaround should be added to the mp4/mov demuxer, but I am leaning to no.

@balling: Repetition flags in the bitstream only ever say: "Output this frame twice", but never "play the whole video twice".

comment:6 by mkver, 4 years ago

Summary: Copy codec doubles video streamCopy codec doubles duration of video stream

comment:7 by MarianD, 4 years ago

Thanks, it helped. I didn't found the

-ignore_editlist

option in FFmpeg documentation.

comment:8 by Gyan, 4 years ago

Yes, I'll update the docs for the MOV/MP4 muxer soon.

Note: See TracTickets for help on using tickets.