After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 651320 - avenc_mpeg4: Implement profile negotiation via caps
avenc_mpeg4: Implement profile negotiation via caps
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-libav
git master
Other Linux
: Normal normal
: 1.3.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 727932
 
 
Reported: 2011-05-28 11:42 UTC by Christian Fredrik Kalager Schaller
Modified: 2014-06-21 16:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
dotfile image (643.47 KB, image/png)
2014-06-04 08:25 UTC, Christian Fredrik Kalager Schaller
Details

Description Christian Fredrik Kalager Schaller 2011-05-28 11:42:05 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
Comment 1 Christian Fredrik Kalager Schaller 2014-02-03 12:05:08 UTC
Just verified that this is still an issue in current git master of gst-libav
Comment 2 Christian Fredrik Kalager Schaller 2014-04-10 11:30:34 UTC
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.
Comment 3 Christian Fredrik Kalager Schaller 2014-05-29 10:46:30 UTC
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.
Comment 4 Wim Taymans 2014-05-29 16:30:59 UTC
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.
Comment 5 Christian Fredrik Kalager Schaller 2014-05-30 15:15:55 UTC
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.
Comment 6 Wim Taymans 2014-05-31 21:47:17 UTC
(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?
Comment 7 Christian Fredrik Kalager Schaller 2014-06-02 16:04:31 UTC
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?
Comment 8 Christian Fredrik Kalager Schaller 2014-06-02 16:54:14 UTC
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
Comment 9 Wim Taymans 2014-06-02 17:37:19 UTC
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.
Comment 10 Christian Fredrik Kalager Schaller 2014-06-04 08:25:12 UTC
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.
Comment 11 Wim Taymans 2014-06-06 12:32:47 UTC
it's supposed to be advanced-simple (with '-'), not advancedsimple.
Comment 12 Wim Taymans 2014-06-06 14:55:52 UTC
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.
Comment 13 Tim-Philipp Müller 2014-06-21 00:04:03 UTC
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
Comment 14 Sebastian Dröge (slomo) 2014-06-21 16:31:36 UTC
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.