GNOME Bugzilla – Bug 651320
avenc_mpeg4: Implement profile negotiation via caps
Last modified: 2014-06-21 16:31:36 UTC
There are at least two codec profiles that needs to be enabled for this codec through caps, Simple and Advanced Simple. In the presets I made for Transmageddon I researched the two profiles to be configured through caps like this: Simple Profile flags=0x00400004 Advanced Simple Profile flags=0x00400036
Just verified that this is still an issue in current git master of gst-libav
Ok, got a Debian bug report today complaining about missing xvid support. Since xvid is MPEG4 part 2 using the Advanced Simple profile this would be really nice to get added.
Anyone willing to take a stab at this one? I would really love to be able to offer 'xvid' support again in Transmageddon. Also this is the only video codec we have no plugins for currently where the profiles are not exposed through caps.
See if this fixes it. You can now also force video/x-xvid on the srcpad to make it output MPEG4 advanced-simple profile. commit 2ef3c94b82ef54673ff838c48483e5b50ff59274 Author: Wim Taymans <wtaymans@redhat.com> Date: Thu May 29 18:24:20 2014 +0200 avcodecmap: handle simple and advanced-simple profile in MPEG4 Always enable 4MV flag for MPEG4 Pare the profile property and enable more features for advanced-simple profile. video/x-xvid is advanced-simple profile so enable more features. We now also support encoding of video/x-xvid so add this to the caps. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=651320 commit 3dda75f493a0c820cc753eddb5d866a30b9ab091 Author: Wim Taymans <wtaymans@redhat.com> Date: Thu May 29 18:16:42 2014 +0200 avvidenc: do all negotiation before opening the decoder We first want to complete negotiation before opening the encoder. Negotiation might configure flags and other things that might be needed when opening the encoder. commit e066785ad05f9119e3c1eded46260bcabd556b4d Author: Wim Taymans <wtaymans@redhat.com> Date: Thu May 29 17:00:23 2014 +0200 avcodecmap: do more reverse mapping of MPEG4 We previously mapped some caps to MPEG4 and codec_tag so we can use the codec_tag again to map to the original caps.
Ok, tested this today. If we are going to do this by re-introducing the video/x-xvid we need to also re-add the mapping of that codec to relevant muxers, specifically AVI and Matroska. Also there needs to be an Xvid description added to pbutils, but that is a 1 line change (did it locally here). Also I do think having the option of choosing the two profiles using the format of "video/mpeg, mpegversion=4, profile=advanced-simple" and "video/mpeg, mpegversion=4, profile=simple" would be good.
(In reply to comment #5) > Ok, tested this today. If we are going to do this by re-introducing the > video/x-xvid we need to also re-add the mapping of that codec to relevant > muxers, specifically AVI and Matroska. Also there needs to be an Xvid > description added to pbutils, but that is a 1 line change (did it locally > here). I'm not sure, video/x-xvid wasn't really removed, there were plenty of places where it was still in use, gst-inspect-1.0 avdec_mpeg4 was still accepting it, for example. Now it sounds like we removed it for a reason from everywhere else (I guess because it's just like mpeg4), then I would suggest to removed it from the encoder too again. > > Also I do think having the option of choosing the two profiles using the format > of "video/mpeg, mpegversion=4, profile=advanced-simple" and "video/mpeg, > mpegversion=4, profile=simple" would be good. That should be possible and it was the main solution, did you try it and did it fail?
The profile option is not in the plugin on my system, but since I got the xvid one I do think I have the latest code installed now. Sure you committed everything?
ok, just grabbed latest git and tried again. Here is what I see in gst-inspect: Pad Templates: SRC template: 'src' Availability: Always Capabilities: video/mpeg mpegversion: 4 systemstream: false video/x-xvid video/x-divx divxversion: 5
That's normal, just try to use a capsfilter with a profile restriction and it should work. It should probably be added to the source caps as well.
Created attachment 277858 [details] dotfile image Tried using the profile option with mpeg4. Seems to work with the encoder, but it seems the mpeg4 parser chockes on it? See attached dotfile image for details.
it's supposed to be advanced-simple (with '-'), not advancedsimple.
did some more changes: commit 57b1970395d8bd79fbea761dbde7f3ccab84ac1c Author: Wim Taymans <wtaymans@redhat.com> Date: Fri Jun 6 16:52:28 2014 +0200 avcodecmap: place supported profiles in mpeg4 caps Place the supported profiles in the srcpad caps of the mpeg4 encoder. commit 9d0e1ecedc2f4274ce55c141e25752e15a120346 Author: Wim Taymans <wtaymans@redhat.com> Date: Fri Jun 6 16:25:43 2014 +0200 avcodecmap: remove deprecated media types Remove x-xvid and x-3ivx. The last place where they were used are in the srcpad caps of the decoder but since the decoder will never actually output those caps we can safely remove them. commit df8674f6c3deb581b3342e59b7ee299a2b4de3d2 Author: Wim Taymans <wtaymans@redhat.com> Date: Fri Jun 6 16:19:07 2014 +0200 codecmap: don't expose more deprecated media types x-xvid is deprecated, we don't want to expose it on the encoder, just leave it only exposed on the decoder. commit fd7ba73304377e2e52580176d1da53e0e2b70541 Author: Wim Taymans <wtaymans@redhat.com> Date: Fri Jun 6 16:16:27 2014 +0200 Revert "avcodecmap: do more reverse mapping of MPEG4" This reverts commit e066785ad05f9119e3c1eded46260bcabd556b4d. x-xvid and x-3ivx are removed, we don't want to expose them again.
This commit: commit 57b1970395d8bd79fbea761dbde7f3ccab84ac1c Author: Wim Taymans <wtaymans@redhat.com> Date: Fri Jun 6 16:52:28 2014 +0200 avcodecmap: place supported profiles in mpeg4 caps Place the supported profiles in the srcpad caps of the mpeg4 encoder. breaks 'make check' in gst-libav for me: tpm@xps:~/gst/master/gst-libav$ cat tests/check/generic/libavcodec-locking.log Running suite(s): Pipelines Unexpected critical/warning: gst_pad_set_caps: assertion 'caps != NULL && gst_caps_is_fixed (caps)' failed
commit e42cc965668b92ec5e4f062124f9c50e1da65fcd Author: Sebastian Dröge <sebastian@centricular.com> Date: Sat Jun 21 18:29:32 2014 +0200 avvidenc: Make sure to fixate caps before setting them on the pad After the recent addition of negotiation support for MPEG4 part 2 profiles via caps it can happen that the generated caps at this point still contain multiple profiles. For example if downstream does not care. Just fixate anything here and use those caps.