@ -498,39 +498,20 @@ static int write_video_frame(AVFormatContext *oc, OutputStream *ost)
frame = get_video_frame ( ost ) ;
if ( oc - > oformat - > flags & AVFMT_RAWPICTURE ) {
/* a hack to avoid data copy with some raw video muxers */
AVPacket pkt ;
av_init_packet ( & pkt ) ;
if ( ! frame )
return 1 ;
pkt . flags | = AV_PKT_FLAG_KEY ;
pkt . stream_index = ost - > st - > index ;
pkt . data = ( uint8_t * ) frame ;
pkt . size = sizeof ( AVPicture ) ;
AVPacket pkt = { 0 } ;
av_init_packet ( & pkt ) ;
pkt . pts = pkt . dts = frame - > pts ;
av_packet_rescale_ts ( & pkt , c - > time_base , ost - > st - > time_base ) ;
/* encode the image */
ret = avcodec_encode_video2 ( c , & pkt , frame , & got_packet ) ;
if ( ret < 0 ) {
fprintf ( stderr , " Error encoding video frame: %s \n " , av_err2str ( ret ) ) ;
exit ( 1 ) ;
}
ret = av_interleaved_write_frame ( oc , & pkt ) ;
if ( got_packet ) {
ret = write_frame ( oc , & c - > time_base , ost - > st , & pkt ) ;
} else {
AVPacket pkt = { 0 } ;
av_init_packet ( & pkt ) ;
/* encode the image */
ret = avcodec_encode_video2 ( c , & pkt , frame , & got_packet ) ;
if ( ret < 0 ) {
fprintf ( stderr , " Error encoding video frame: %s \n " , av_err2str ( ret ) ) ;
exit ( 1 ) ;
}
if ( got_packet ) {
ret = write_frame ( oc , & c - > time_base , ost - > st , & pkt ) ;
} else {
ret = 0 ;
}
ret = 0 ;
}
if ( ret < 0 ) {