Opened 5 months ago

Last modified 3 months ago

#6131 new defect

Splitting and then merging h264 .MOV produces corrupted video

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

Description

In short

I cut two parts from some video, then combine them back and getting the result critically broken
(it's a simplified debug case from a real video merging).
Bisected ffmpeg git, the error appears after this (between release 3.0 and 3.1):

b8fa374 lavf/concatdec: remove unrelated change during codecpar merge.

Details

Source video: h264 .MOV from my photocamera.
Note 1: time 3.003 in the commands below is a keyframe in the source video:

$ ffprobe -loglevel error -read_intervals +3 -show_frames -select_streams v -print_format xml /tmp/P2040190.MOV | grep -m1 3.003

<frame media_type="video" stream_index="0" key_frame="1" pkt_pts="270270" pkt_pts_time="3.003000" pkt_dts="270270" pkt_dts_time="3.003000" best_effort_timestamp="270270" best_effort_timestamp_time="3.003000" pkt_duration="3003" pkt_duration_time="0.033367" pkt_pos="3998057" pkt_size="60194" width="1280" height="720" pix_fmt="yuvj420p" sample_aspect_ratio="1:1" pict_type="I" coded_picture_number="15" display_picture_number="0" interlaced_frame="0" top_field_first="0" repeat_pict="0"/>

Note 2: ffplay still prints such a line in the "good" case at the problematic place. But everything else is fine.

"[h264 @ 0x7f840c0dcfc0] Reinit context to 1280x720, pix_fmt: yuvj420p"

Example commands are below. Attached logs for bad commits b8fa374 and 0cb19c3 (errors differ a bit between them) and good commit f8d1bb2.
ffplay had to be interrupted manually at the end for all cases.
Also attached output of "out-f8d1bb2/ffmpeg -v 9 -loglevel 99 -i /tmp/P2040190.MOV"

checkme()
{

set -x
FF="/mnt/wrk/ffmpeg/out-f8d1bb2/ffmpeg"
OUTVID="."
set -e
echo -e 'file start.mkv\nfile end.mkv' > list.txt
$FF -y -t 3.003 -i "/tmp/P2040190.MOV" -an "$OUTVID/start.mkv"
$FF -y -ss 3.003 -t 5 -i "/tmp/P2040190.MOV" -c:v copy -an "$OUTVID/end.mkv"
$FF -y -f concat -i "$OUTVID/list.txt" -c:v copy -an "$OUTVID/merge.mkv"
set +e
ffplay "$OUTVID/merge.mkv"

}

Attachments (4)

check-0cb19c3.log (49.2 KB) - added by andrewt 5 months ago.
check-b8fa374.log (63.1 KB) - added by andrewt 5 months ago.
check-f8d1bb2.log (55.7 KB) - added by andrewt 5 months ago.
src-video-info.txt.gz (1.1 MB) - added by andrewt 5 months ago.

Download all attachments as: .zip

Change History (11)

Changed 5 months ago by andrewt

Changed 5 months ago by andrewt

Changed 5 months ago by andrewt

Changed 5 months ago by andrewt

comment:1 follow-up: Changed 5 months ago by cehoyos

  • Component changed from ffmpeg to undetermined

Is the issue reproducible with current FFmpeg git head?

comment:2 in reply to: ↑ 1 Changed 5 months ago by andrewt

Replying to cehoyos:

Is the issue reproducible with current FFmpeg git head?

Yes. More info for latest releases and git master:

release 2.5: bad
release 2.6: bad
release 2.7: good
release 2.8: good
release 2.9: good
release 3.0: good
release 3.1: bad
release 3.2: bad
git master: bad

comment:3 Changed 5 months ago by cehoyos

Please provide an input file that allows to reproduce the issue.

comment:4 Changed 5 months ago by cehoyos

  • Version changed from 3.1.5 to git-master

comment:5 Changed 5 months ago by andrewt

ftp://upload.ffmpeg.org seems broken. Uploaded to google drive (download button in the top right corner):
https://drive.google.com/file/d/0B_QcRLu0oJxMeWl3bWxNRWhyYW8/view?usp=sharing
It's an original video from photocamera cut down to 10MB (by dd command, as described in ffmpeg howto).

Just in case, it should be noted that b8fa374 introduces errors printed in console, but video playback seems ok for a first sight.
Playback breaks with the next commit 0cb19c3 with some different errors.

comment:6 Changed 5 months ago by andrewt

md5sum of trac6131-broken-concat.MOV : 3f49e8b85446739c10714a0546fb7a87

comment:7 Changed 3 months ago by andrewt

Is it enough? Can search for a hosting with direct link.

Changes introduced in both commits are not huge, can try to revert them and look what will happen

https://github.com/FFmpeg/FFmpeg/commit/b8fa374fb6eba995a9d5dd50f714f9faff43b81b

https://github.com/FFmpeg/FFmpeg/commit/0cb19c30c6a14418eaa6858db303602815fe3ab1

Note: See TracTickets for help on using tickets.