GNOME Bugzilla – Bug 560305
x264enc & ffmux_* doesnt link
Last modified: 2008-11-11 17:18:59 UTC
Please describe the problem: If x264enc is tried to link with any of the ffmux_* it doesnt link, and gives error "Aspect ratio mismatch between encoder and muxer layer". This comes since x264enc src caps has "pixel-aspect-ratio=(fraction)1/1", while if I use ffenc_mpeg4 it works since the src caps doesnt have any "pixel-aspect-ratio" caps. On further investigation it revealed that this problem occurs due to a probable bug in ffmpeg ie, in "libavformat/utils.c: (av_write_header):" there is a "av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)" check that fails. This happens since the aspect ratio incase of x264enc is set in st->codec->sample_aspect_ratio = {1, 1}, while the mux output st->sample_aspect_ratio = {0, 1}. If this check is commented it works fine. Steps to reproduce: 1. gst-launch-0.10 filesrc location=1.flv ! flvdemux ! ffdec_vp6f ! x264enc ! ffmux_3gp ! filesink location=test.3gp -v 2. gst-launch-0.10 filesrc location=1.flv ! flvdemux ! ffdec_vp6f ! ffenc_mpeg4 ! ffmux_3gp ! filesink location=test.3gp -v Actual results: 1. Doesnt work, gives error "Aspect ratio mismatch between encoder and muxer layer" 2. Works. Expected results: x264enc case should also work. Does this happen every time? yes Other information: This is valid for any ffmux_*
Created attachment 122397 [details] [review] possible patch Thi patch copies the aspect ratio set in the codec context to the stream.
This looks correct to me - the codec should hold the pixel-aspect-ratio (if any) extracted from the caps.
* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_setcaps): Copy the codec aspect ratio to the stream, ffmpeg expects them to be the same. Fixes #560305.