[FFmpeg-user] Cutting at key frames with H.264 and FFmpeg

fibarra fibarra at atnova.com
Mon May 20 16:18:56 CEST 2013


I have videos generated with Flash Media Encoder and the VP6 codec.

I'm able to edit these videos manipulating their tags with .NET, but I can
only cut between key frames. I want a more precise manipulation, so, I'm
looking into ffmpeg.

It seems that I have only two codecs for FLV: Sorenson (which has a very low
quality), and H.264.

I'm trying with the H.264 codec, but something seems to be wrong with the
re-encoded video and its key frames. ffprobe gives me different key frames
than my .NET application, and when I try to cut using these frames without
re-encoding, the image stays frozen from the begining to the next key frame.

My conversión command:
ffmpeg -i imput.flv -acodec mp3 -b:a 22k -vcodec libx264 -b:v 448k  \
-r 12 -force_key_frames expr:gte(t,n_forced*5) -f flv output.flv -y


My cut command:
ffmpeg -i output.flv -ss 00:00:06.250 -t 00:00:10.00 -acodec copy -vcodec
copy result.flv -y


My ffprobe command:
ffprobe -show_frames -select_streams v -print_format json=c=1 output.flv


Part of the ffprobe result:
    { "media_type": "video", "key_frame": 0, "pkt_pts": 6250, "pkt_pts_time"
: "6.250000", "pkt_dts": 6250, "pkt_dts_time": "6.250000", "pkt_duration":
83, "
pkt_duration_time": "0.083000", "pkt_pos": "156571", "pkt_size": "5407",
"width"
: 684, "height": 512, "pix_fmt": "yuv420p", "pict_type": "P",
"coded_picture_num
ber": 42, "display_picture_number": 0, "interlaced_frame": 0,
"top_field_first":
 0, "repeat_pict": 0 },
        { "media_type": "video", "key_frame": 1, "pkt_pts": 6333,
"pkt_pts_time"
: "6.333000", "pkt_dts": 6333, "pkt_dts_time": "6.333000", "pkt_duration":
83, "
pkt_duration_time": "0.083000", "pkt_pos": "169303", "pkt_size": "89000",
"width
": 684, "height": 512, "pix_fmt": "yuv420p", "pict_type": "I",
"coded_picture_nu
mber": 46, "display_picture_number": 0, "interlaced_frame": 0,
"top_field_first"
: 0, "repeat_pict": 0 }


Am I missing something?




--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Cutting-at-key-frames-with-H-264-and-FFmpeg-tp4659225.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list