[FFmpeg-user] ffmpeg stream copy does NOT set AV_PKT_FLAG_KEY when input_format h264

Soho Soho123 soho123.2012 at gmail.com
Fri Mar 22 11:38:48 CET 2013


Hi All,

ffmpeg command I used:
ffmpeg  -loglevel debug -f video4linux2 -r 10 -s 640x480 -input_format
h264 -i /dev/video1 -vcodec copy http://localhost:8090/feed1.ffm

the result is : discard all video data when ffmpeg do stream copy,
because in ffmpeg.c, function do_streamcopy()
the check :

 if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) &&
        !ost->copy_initial_nonkeyframes){
        return;
    }

it will return directly, then no any frame will be put to output stream.
I confused about:
1. why does not set AV_PKT_FLAG_KEY when stream copy?
when I set input_format yuyv, the video data will be set
AV_PKT_FLAG_KEY in function compute_pkt_fields , since is_intra_only
is true.

even I add option "-copyinkf" in command line,
ost->copy_initial_nonkeyframes still get 0.
why?
if no any frame is output, then ost->frame_number=0,
and pkt->flags does not set AV_PKT_FLAG_KEY ,
and option "-copyinkf" does not take effect,
then the stream copy for input_format h264 is FAIL ====>the check is
very strange!!!!!!!

Does anyone have ideas?


More information about the ffmpeg-user mailing list