Opened 7 years ago

Closed 3 years ago

Last modified 3 years ago

#6131 closed defect (needs_more_info)

Splitting and then merging h264 .MOV produces corrupted video

Reported by: andrewt Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: concat regression
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 7 years ago.
check-b8fa374.log (63.1 KB ) - added by andrewt 7 years ago.
check-f8d1bb2.log (55.7 KB ) - added by andrewt 7 years ago.
src-video-info.txt.gz (1.1 MB ) - added by andrewt 7 years ago.

Download all attachments as: .zip

Change History (14)

by andrewt, 7 years ago

Attachment: check-0cb19c3.log added

by andrewt, 7 years ago

Attachment: check-b8fa374.log added

by andrewt, 7 years ago

Attachment: check-f8d1bb2.log added

by andrewt, 7 years ago

Attachment: src-video-info.txt.gz added

comment:1 by Carl Eugen Hoyos, 7 years ago

Component: ffmpegundetermined

Is the issue reproducible with current FFmpeg git head?

in reply to:  1 comment:2 by andrewt, 7 years ago

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 by Carl Eugen Hoyos, 7 years ago

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

comment:4 by Carl Eugen Hoyos, 7 years ago

Version: 3.1.5git-master

comment:5 by andrewt, 7 years ago

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 by andrewt, 7 years ago

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

comment:7 by andrewt, 7 years ago

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

comment:8 by andrewt, 6 years ago

Ping?
Version 3.3.5 still produces corrupted videos.

comment:9 by andrewt, 3 years ago

Resolution: fixed
Status: newclosed

ffmpeg 4.3.2 from current Fedora 33 repos (ffmpeg-4.3.2-2.fc33.x86_64) produces no issues on this case.

Only noticeable print is:
[swscaler @ 0x7f4d682f28c0] deprecated pixel format used, make sure you did set range correctly
which is unrelated, I think.

Closing this ticket.

comment:10 by Carl Eugen Hoyos, 3 years ago

Component: undeterminedavformat
Keywords: concat regression added
Resolution: fixedneeds_more_info

I can indeed reproduce a concat regression since b8fa374fb6eba995a9d5dd50f714f9faff43b81b (see ticket #5461) but it was already fixed in 0cb19c30c6a14418eaa6858db303602815fe3ab1 which was the subsequent commit. There may have been another issue related to libx264 but I am unable to test it atm.

Note: See TracTickets for help on using tickets.