GNOME Bugzilla – Bug 532422
avenc_dvvideo: Add non-exposed framerate/width/height/format limitations to caps
Last modified: 2013-01-01 23:17:42 UTC
$ gst-launch videotestsrc ! videorate ! videoscale ! ffmpegcolorspace ! ffenc_dvvideo ! fakesink Setting pipeline to PAUSED ... Pipeline is PREROLLING ... 0:00:00.331844669 26793 0x81c2f00 ERROR ffmpeg gstffmpegenc.c:615:gst_ffmpegenc_chain_video:<ffenc_dvvideo0> ffenc_dvvideo: failed to encode buffer 0:00:00.332856490 26793 0x81c2f00 ERROR ffmpeg gstffmpegenc.c:615:gst_ffmpegenc_chain_video:<ffenc_dvvideo0> ffenc_dvvideo: failed to encode buffer 0:00:00.333797840 26793 0x81c2f00 ERROR ffmpeg gstffmpegenc.c:615:gst_ffmpegenc_chain_video:<ffenc_dvvideo0> ffenc_dvvideo: failed to encode buffer 0:00:00.334671790 26793 0x81c2f00 ERROR ffmpeg gstffmpegenc.c:615:gst_ffmpegenc_chain_video:<ffenc_dvvideo0> ffenc_dvvideo: failed to encode buffer 0:00:00.335537499 26793 0x81c2f00 ERROR ffmpeg gstffmpegenc.c:615:gst_ffmpegenc_chain_video:<ffenc_dvvideo0> ffenc_dvvideo: failed to encode buffer 0:00:00.336407678 26793 0x81c2f00 ERROR ffmpeg gstffmpegenc.c:615:gst_ffmpegenc_chain_video:<ffenc_dvvideo0> ffenc_dvvideo: failed to encode buffer 0:00:00.337271920 26793 0x81c2f00 ERROR ffmpeg gstffmpegenc.c:615:gst_ffmpegenc_chain_video:<ffenc_dvvideo0> ffenc_dvvideo: failed to encode buffer 0:00:00.338135813 26793 0x81c2f00 ERROR ffmpeg gstffmpegenc.c:615:gst_ffmpegenc_chain_video:<ffenc_dvvideo0> ffenc_dvvideo: failed to encode buffer 0:00:00.339005923 26793 0x81c2f00 ERROR ffmpeg gstffmpegenc.c:615:gst_ffmpegenc_chain_video:<ffenc_dvvideo0> ffenc_dvvideo: failed to encode buffer 0:00:00.339875543 26793 0x81c2f00 ERROR ffmpeg gstffmpegenc.c:615:gst_ffmpegenc_chain_video:<ffenc_dvvideo0> ffenc_dvvideo: failed to encode buffer 0:00:00.340740065 26793 0x81c2f00 ERROR ffmpeg gstffmpegenc.c:615:gst_ffmpegenc_chain_video:<ffenc_dvvideo0> ffenc_dvvideo: failed to encode buffer
However, the following does work: gst-launch videotestsrc num-buffers=10 ! videoscale ! ffmpegcolorspace ! video/x-raw-yuv,format="(fourcc)I420",width=720,height=576 ! ffenc_dvvideo ! fakesink This is one of those cases where the ffmpeg encoder is somewhat picky about format and/or sizes it actually supports (and more so than its API might report), and that may need some special case'ing to determine supported caps. (see also a few other cases at http://gentrans.sourceforge.net/docs/head/manual/html/howto.html#sect-ffmpeg-encoders)
we have to add these constraints to the dv encoder caps.
Making the bug title more generic. The whole caps stuff in gstffmpegcodecmap.c is a total mess right now. We basically need to add to the caps the limitations that the encoders have... but which aren't obviously exposed.
*** Bug 539847 has been marked as a duplicate of this bug. ***
The g726 encoder also has additional limitations: if (avctx->channels != 1 || (avctx->bit_rate != 16000 && avctx->bit_rate != 24000 && avctx->bit_rate != 32000 && avctx->bit_rate != 40000)) { av_log(avctx, AV_LOG_ERROR, "G726: unsupported audio format\n"); return -1; } if (avctx->sample_rate != 8000 && avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL) { av_log(avctx, AV_LOG_ERROR, "G726: unsupported audio format\n"); return -1; }
Created attachment 115423 [details] [review] Patch to expose (more) limitations to caps Following some moderately systematic probing, this should cover at least most limitations regarding width/height, pixel format and samplerate. At present, these are primarily applied to (raw) encoder input caps, whereas others are left "wide".
Looks good to me and should be committed as it improves the current situation a lot. But it seems that the g726 limitations I've written above are not included in your patch, right? So there's probably more to improve here :)
2008-10-08 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_vid_caps_new), (gst_ff_aud_caps_new), (gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_codectype_to_caps): * ext/ffmpeg/gstffmpegcodecmap.h: * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_negotiate), (gst_ffmpegdec_register): * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps), (gst_ffmpegenc_register): Add some more width/height/channels/rate limitations to caps to cater for more automagic negotiation. Addresses #532422. Regarding g726 limitations above: - it seems that the current ffmpeg code has somewhat changed, though still also involves combinations of bitrate and samplerate. However, we can't have property dependent caps, so hard to express that. - the mono audio limitation is included in the patch. So, I think all that can be (regarding g726) is included, which is not to say there may be gaps/improvements possible elsewhere ...
*** Bug 547583 has been marked as a duplicate of this bug. ***
*** Bug 564105 has been marked as a duplicate of this bug. ***
The original pipeline works now in git master, and I think we have this generally covered as good as possible for most cases, but will probably still have to add some special cases. Also see bug #600895 .