[Libav-user] Using AV_CODEC_ID_RAWVIEO with images
Pradeep Karosiya
praks411 at gmail.com
Mon Jun 17 15:02:09 CEST 2013
Hi,
I'm trying to encode a video from image buffer. I want to encode it as raw
video format, so I have used AV_CODEC_ID_RAWVIDEO as codec_id and also set
format flags in AVFormatContext to AVFMT_RAWPICTURE. When I run the loop the
generated video is blank it only show black screen.
However when I used some other codec_id like AV_CODEC_ID_MP4 it works fine.
I'm following decoding_encoding.c example.
Please suggest something what could be going wrong.
Snippet of code which is writing frame
if (oc->oformat->flags & AVFMT_RAWPICTURE || video_st->codec->codec_id ==
CODEC_ID_JPEGLS
||video_st->codec->codec_id == AV_CODEC_ID_RAWVIDEO)
{
/* raw video case. The API will change slightly in the near
futur for that */
AVPacket pkt;
av_init_packet(&pkt);
pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index= video_st->index;
pkt.data= (uint8_t *)picture;
pkt.size= sizeof(AVPicture);
pkt.destruct = NULL;
PRINT_VAL("Size of Vid Pkt ", pkt.size)
vid_pts++;
pkt.pts = av_rescale_q(vid_pts, video_st->codec->time_base,
video_st->time_base);
pkt.dts = pkt.pts;
pkt.duration = 0;
if((ret = av_interleaved_write_frame(oc, &pkt)) < 0)
{
PRINT_MSG("Failed to Write Video Frame ")
}
}
Thanks
Pradeep
--
View this message in context: http://libav-users.943685.n4.nabble.com/Using-AV-CODEC-ID-RAWVIEO-with-images-tp4657907.html
Sent from the libav-users mailing list archive at Nabble.com.
More information about the Libav-user
mailing list