ff-save: make encoding work with more different pixel formats

parent b56b5f29
......@@ -501,7 +501,9 @@ add_video_stream (GeglProperties *o, AVFormatContext * oc, int codec_id)
/* frames per second */
st->time_base =(AVRational){1, o->frame_rate};
c->time_base = st->time_base;
c->pix_fmt = AV_PIX_FMT_YUV420P;
if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO)
{
......@@ -595,6 +597,17 @@ open_video (Priv * p, AVFormatContext * oc, AVStream * st)
exit (1);
}
if (codec->pix_fmts){
int i = 0;
c->pix_fmt = codec->pix_fmts[0];
while (codec->pix_fmts[i] !=-1)
{
if (codec->pix_fmts[i] == AV_PIX_FMT_RGB24)
c->pix_fmt = AV_PIX_FMT_RGB24;
i++;
}
}
/* open the codec */
if (avcodec_open2 (c, codec, NULL) < 0)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment