[FFmpeg-trac] #6131(ffmpeg:new): Splitting and then merging h264 .MOV produces corrupted video

FFmpeg trac at avcodec.org
Tue Feb 7 19:02:39 EET 2017

#6131: Splitting and then merging h264 .MOV produces corrupted video
             Reporter:  andrewt  |                     Type:  defect
               Status:  new      |                 Priority:  normal
            Component:  ffmpeg   |                  Version:  3.1.5
             Keywords:           |               Blocked By:
             Blocking:           |  Reproduced by developer:  0
Analyzed by developer:  0        |
 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
   b8fa374 lavf/concatdec: remove unrelated change during codecpar merge.


 Source video: h264 .MOV from my photocamera.
 Note 1: time 3.003 in the commands below is a keyframe in the source
    {{{ $ 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:

 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

     set -x
     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
     $FF -y -f concat -i "$OUTVID/list.txt" -c:v copy -an
     set +e
     ffplay "$OUTVID/merge.mkv"

Ticket URL: <https://trac.ffmpeg.org/ticket/6131>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list