gstreamer does not play H.264 AVC video

I am experimenting a bit with gstreamer. Because I want to learn something I use version 1.8.3 not 0.10 (not sure whether it would make a difference).

Now I wanted to play a old video snip I happened to have on my disk

$ gst-play-1.0 ex1.mp4

plays the sound but complains about

WARNING No decoder available for type 'video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3.1, profile=(string)high,

and shows no picture. Not too surpsing gst-inspect-1.0 does not list a H.264 decoder

I googled a bit and found the same question from years ago. The answer was that gstreamer uses ffmpeg codecs for H.264 decoding.

I don’t see an ffmpeg plugin but I have

 i | gstreamer-plugins-libav                                | package | 1.8.3-2.6           | x86_64 | packman-essentials

I understand that libav is a fork of ffmpeg, so it should be rather similar.

If I use ffplay to play the above example video it reports

 Video: h264 (High) (avc1 / 0x31637661)

for the video stream and it works.

My ffmpeg installation uses

libavcodec     57. 64.100 / 57. 64.100

according to its own output. And not surprising after it works it lists a
decoder

$ ffmpeg -decoders 2>/dev/null | grep 264
 VFS..D h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
 V....D h264_vdpau           H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration) (codec h264)

If I check on packaging level both

$ rpm -qi --requires ffmpeg
$ rpm -qi --requires gstreamer-plugins-libav

require

libavcodec.so.57()(64bit)
libavcodec.so.57(LIBAVCODEC_57)(64bit)

but that I have installed

 $ rpm -qi --whatprovides "libavcodec.so.57()(64bit)"
Name        : libavcodec57
Version     : 3.2
Release     : 6.6
Architecture: x86_64
Install Date: Mon 06 Mar 2017 08:47:16 PM EET
Group       : System/Libraries
Size        : 11080472
License     : LGPL-2.1+ and GPL-2.0+
Signature   : RSA/SHA1, Sat 25 Feb 2017 05:25:52 AM EET, Key ID 45a1d0671abd1afb
Source RPM  : ffmpeg-3.2-6.6.src.rpm
Build Date  : Fri 24 Feb 2017 04:53:00 PM EET
Build Host  : swkj12
Relocations : (not relocatable)
Packager    : packman@links2linux.de
Vendor      : http://packman.links2linux.de
URL         : https://ffmpeg.org/
Summary     : FFmpeg codec library
...

So how comes that H.264 decoding works in ffmpeg but not in gstreamer if they are supposed to use the same code in the end?

Did you read the “sticky” threads at the beginning of this Multimedia forum?

And did you do the “Vendor switch to Packman”?

When it is not 100% sure you have done that switch, most people will wait until you did and report that you have still problems before they will try to help you.

your ffmpeg libraries look like are from packman that does not mean all of your multimedia is from packman as hcvv said you need to do a full vendor change
I’m not sure if gstreamer uses ffmpeg libraries
tell us your repo list

zypper lr -d

yes

Yes.

Did you read my post:

...
Packager    : packman@links2linux.de
...

Although this machine was updated from 13.2 to 41.1 and 42.2 not too long ago and some mess happened there. I think I have cleaned it up, but let’s double check

zypper se -s gstreamer | grep ^v | grep -v 0_10
v | gstreamer-fluendo-mp3                                  | package     | 21-1.3              | x86_64 | Main Repository (NON-OSS)  
v | gstreamer-plugins-bad                                  | package     | 1.8.3-3.1           | x86_64 | Main Update Repository     
v | gstreamer-plugins-bad                                  | package     | 1.8.3-1.3           | x86_64 | Main Repository (OSS)      
v | gstreamer-plugins-base                                 | package     | 1.8.3-1.4           | x86_64 | Main Repository (OSS)      
v | gstreamer-plugins-good                                 | package     | 1.8.3-1.3           | x86_64 | Main Repository (OSS)      
v | gstreamer-plugins-good-extra                           | package     | 1.8.3-1.3           | x86_64 | Main Repository (OSS)      
v | gstreamer-plugins-ugly                                 | package     | 1.8.3-1.2           | x86_64 | Main Repository (OSS)

So all alternative versions offered are from OpenSUSE repos, i. e. the installed ones are from packman (I have no vlc repos or anything else and never had)

$ zypper se -s ffmpeg | grep ^v
v | ffmpeg                                    | package    | 3.2-4.1                | x86_64 | Main Update Repository
v | ffmpeg                                    | package    | 3.1.3-2.1              | x86_64 | Main Repository (OSS) 
$ zypper se -s libav | grep ^v
v | libavcodec57                            | package    | 3.2-4.1            | x86_64 | Main Update Repository
v | libavcodec57                            | package    | 3.1.3-2.1          | x86_64 | Main Repository (OSS) 
v | libavdevice57                           | package    | 3.2-4.1            | x86_64 | Main Update Repository
v | libavdevice57                           | package    | 3.1.3-2.1          | x86_64 | Main Repository (OSS) 
v | libavfilter6                            | package    | 3.2-4.1            | x86_64 | Main Update Repository
v | libavfilter6                            | package    | 3.1.3-2.1          | x86_64 | Main Repository (OSS) 
v | libavformat57                           | package    | 3.2-4.1            | x86_64 | Main Update Repository
v | libavformat57                           | package    | 3.1.3-2.1          | x86_64 | Main Repository (OSS) 
v | libavresample3                          | package    | 3.2-4.1            | x86_64 | Main Update Repository
v | libavresample3                          | package    | 3.1.3-2.1          | x86_64 | Main Repository (OSS) 
v | libavutil55                             | package    | 3.2-4.1            | x86_64 | Main Update Repository
v | libavutil55                             | package    | 3.1.3-2.1          | x86_64 | Main Repository (OSS) 

Ah there is also another set of gstreamer packages called “libgst*”. And indeed some of them were from OpenSUSE repos.

Did a vendor change for all of them.

I still have unchanged

> gst-inspect-1.0 | tail -1
Total count: 228 plugins, 854 features

and the same error message about missing codec.

Can somebody who has it working give me her/his plugin/feature count?

I think that is quite clear from the output of

rpm -qi --requires gstreamer-plugins-libav

It requires libavcodec57 and I think that is an ffmpeg library. At least ffmpeg uses the same one.

$ zypper lr -d
Repository priorities are without effect. All enabled repositories share the same priority.

#  | Alias                           | Name                                    | Enabled | GPG Check | Refresh | Priority | Type   | URI                                                                                            | Service
---+---------------------------------+-----------------------------------------+---------+-----------+---------+----------+--------+------------------------------------------------------------------------------------------------+--------
 1 | download.opensuse.org-non-oss   | Main Repository (NON-OSS)               | Yes     | (r ) Yes  | Yes     |   99     | yast2  | http://download.opensuse.org/distribution/leap/42.2/repo/non-oss/                              |        
 2 | download.opensuse.org-non-oss_1 | Update Repository (Non-Oss)             | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/42.2/non-oss/                                         |        
 3 | download.opensuse.org-oss       | Main Repository (OSS)                   | Yes     | (r ) Yes  | Yes     |   99     | yast2  | http://download.opensuse.org/distribution/leap/42.2/repo/oss/                                  |        
 4 | download.opensuse.org-oss_1     | Main Update Repository                  | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/42.2/oss                                              |        
 5 | openSUSE-42.2-0                 | openSUSE-42.2-0                         | No      | ----      | ----    |   99     | yast2  | hd:///?device=/dev/disk/by-id/usb-Kingston_DataTraveler_2.0_AC220B280C8C101079738F5F-0:0-part2 |        
 6 | packman-essentials              | packman-essentials                      | Yes     | (r ) Yes  | No      |   99     | rpm-md | http://ftp.halifax.rwth-aachen.de/packman/suse/openSUSE_Leap_42.2/                             |        
 7 | repo-debug                      | openSUSE-Leap-42.2-Debug                | No      | ----      | ----    |   99     | yast2  | http://download.opensuse.org/debug/distribution/leap/42.2/repo/oss/                            |        
 8 | repo-debug-non-oss              | openSUSE-Leap-42.2-Debug-Non-Oss        | No      | ----      | ----    |   99     | yast2  | http://download.opensuse.org/debug/distribution/leap/42.2/repo/non-oss/                        |        
 9 | repo-debug-update               | openSUSE-Leap-42.2-Update-Debug         | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/debug/update/leap/42.2/oss/                                       |        
10 | repo-debug-update-non-oss       | openSUSE-Leap-42.2-Update-Debug-Non-Oss | No      | ----      | ----    |   99     | rpm-md | http://download.opensuse.org/debug/update/leap/42.2/non-oss/                                   |        
11 | repo-source                     | openSUSE-Leap-42.2-Source               | No      | ----      | ----    |   99     | yast2  | http://download.opensuse.org/source/distribution/leap/42.2/repo/oss/                           |        
12 | repo-source-non-oss             | openSUSE-Leap-42.2-Source-Non-Oss       | No      | ----      | ----    |   99     | yast2  | http://download.opensuse.org/source/distribution/leap/42.2/repo/non-oss/        

Hey, why is the packman repo reset to refresh “no”.

That must a left-over from the system upgrade.

Let me clean that up and report…

Ah, that is not a problem.

From the man page
*An automatic refresh takes place right before reading metadata from the database if the auto-refresh is enabled for the repository and the metadata is reported to be out of date. If the auto-refresh is disabled, the repository will only be refreshed on user request. You can request a refresh by calling zypper refresh (see the documentation of the refresh command for details)

I call zypper ref regularly

$ sudo zypper ref
root's password:
Repository 'Main Repository (NON-OSS)' is up to date.                                                                                                                 
Repository 'Update Repository (Non-Oss)' is up to date.                                                                                                               
Repository 'Main Repository (OSS)' is up to date.                                                                                                                     
Repository 'Main Update Repository' is up to date.                                                                                                                    
Retrieving repository 'packman-essentials' metadata ............................................................................................................[done]
Building repository 'packman-essentials' cache .................................................................................................................[done]
All repositories have been refreshed.
$ zypper lu
Loading repository data...
Reading installed packages...
No updates found.

Checked the packman OBS, gstreamer-plugins-libav is configured --with-system-libav

Not a surprise after having seen the runtime dependency.

Need to check, wether some codecs from libav possibly could need an extra config option to be used by gstreamer. But it’s getting late, so not today anymore.

Packman is #6 so

zypper dup --from 6

will do the full switch of all codecs installed to packman and the proprietary versions

You may miss some if not initial installed so these you may need to handle manually

.

As gogalthorpe says. We are not interested at all if you show us that one or more individual packages on your system are from Packman. We want to be 1000%sure that you are 100% sure that you did the Vendor switch. El;se the starting point for attacking Multimediia problems is not guaranteed to be the correct one. So please, do not spoil your (and our) time and do as asked, or post back that you are not willing to do so. In the latter case we can go and spend our time on more promising threads.

I’d like to add a thing:
You may also want to install gstreamer-plugins-bad-orig-addons and gstreamer-plugins-ugly-orig-addons.
These contain additional codecs (including a H.264 decoder) that are not included in the standard packages (and don’t use/need ffmpeg either).

Although you definitely should do that full switch to Packman as well, that will rule out any incompatible mixture.

Ah nice. If that command is in the sticky items I have missed it.

But executing it now shows that I had not overlooked anything related to gstreamer or ffmpeg/libav in my manual vendor change.

> sudo zypper dup --from 6
Loading repository data...
Reading installed packages...
Computing distribution upgrade...

The following 4 NEW packages are going to be installed:
  libbctoolbox0 libkcddb16 libmusicbrainz4 libtxc_dxtn

The following package is going to be REMOVED:
  s2tc

The following 4 packages are going to be upgraded:
  k3b libbellesip0 libbzrtp0 mjpegtools

The following 4 packages are going to change vendor:
  k3b           openSUSE -> http://packman.links2linux.de
  libbellesip0  openSUSE -> http://packman.links2linux.de
  libbzrtp0     openSUSE -> http://packman.links2linux.de
  mjpegtools    openSUSE -> http://packman.links2linux.de

After that installation gst-play-1.0 still complains about the same error.

WARNING No decoder available for type 'video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3.1, profile=(string)high

I started to look at the source code of gstreamer/gst-libav - GStreamer plugin for the FFmpeg libav* libraries (mirrored from https://gitlab.freedesktop.org/gstreamer/gst-libav) It’s not as simple as I originally assumed that everything offered by libavcodec is just passed on to gstreamer via the plugin. There is quite some configuration involved. So the fact that the codec is available to ffmpeg from libavcodec does not automatically guarantee that it can be used by gstreamer via gst-plugins-libav, even if both of them use the same physical copy of libavcodec. Need to study more when I have the time… But of course if somebody knows the quick answer that’s very much welcome.

Yes, I know that they are important. Both are installed.

ugly addon brings the following new features:

> # after ugly-original-addon (packman)
15a17,19
> amrnb:  amrnbdec: AMR-NB audio decoder
> amrnb:  amrnbenc: AMR-NB audio encoder
> amrwbdec:  amrwbdec: AMR-WB audio decoder
18a23
> asf:  asfdemux: ASF Demuxer
21a27,28
> asf:  rtpasfdepay: RTP ASF packet depayloader
> asf:  rtspwms: WMS RTSP Extension
260a268
> lame:  lamemp3enc: L.A.M.E. mp3 encoder
347a356
> mad:  mad: mad mp3 decoder
355a365
> mpeg2dec:  mpeg2dec: mpeg1 and mpeg2 video decoder
360a371
> mpg123:  mpg123audiodec: mpg123 mp3 decoder
625c636,637
< Total count: 203 plugins, 822 features
---
> Total count: 213 plugins, 835 features
> twolame:  twolamemp2enc: TwoLAME mp2 encoder
817a830
> x264:  x264enc: x264enc

So that’s an encoder, but not a decoder if x264 refers to H.264. But on the list mpeg2dec is important if you want to watch DVD contents.

And bad addon brings

> # after plugins-bad-orig-addon (packman)
150a151
> dtsdec:  dtsdec: DTS audio decoder
155a157
> dvdspu:  dvdspu: Sub-picture Overlay
173a176,177
> faac:  faac: AAC audio encoder
> faad:  faad: AAC audio decoder
230a235,236
> gstsiren:  sirendec: Siren Decoder element
> gstsiren:  sirenenc: Siren Encoder element
366a372
> mpeg2enc:  mpeg2enc: mpeg2enc video encoder
488a495,496
> rtmp:  rtmpsink: RTMP output sink
> rtmp:  rtmpsrc: RTMP Source
637c645
< Total count: 213 plugins, 835 features
---
> Total count: 223 plugins, 847 features
814a823,824
> voaacenc:  voaacenc: AAC audio encoder
> voamrwbenc:  voamrwbenc: AMR-WB audio encoder
831a842
> x265:  x265enc: x265enc

No H.264 decoder here either. But the AAC decoder is important, because AAC is commonly used in mp4 videos.

These lists are generated by gst-inspect-1.0 | sort (because the output seems to change randomly)

I link all packman packages that I have currently installed. I have checked at least 3 times that nothing interesting seems to be missing, but of course there can always be one error left…

http://paste.opensuse.org/66875256

there have been some changes under opensuse’s hood
for me gstreamer (used in Firefox) did play h264 (x264) + aac ie mp4 video’s with out an issue (the mozilla devs dropped gstreamer support in Firefox and now the Fox uses ffmpeg)
so did other media players that used the gstreamer framework (I can only think of dragon at the moment)
if you want to do encoding from the command line why not use ffmpeg?
it could be something on your side, try and removing the gstreamer cache

re -r ~/.cache/gstreamer-1.0

try using a gstreamer based player like dragon as I’m really not sure what you are trying to accomplish?

did a typo should be

rm -r ~/.cache/gstreamer-1.0

If you install OpenSUSE with XFCE desktop, they give you Totem. Not that I would use it a lot, but I have tested (on another machine, where I have an XFCE installation) and it also complained about the missing H.264 AVC decoder. (But on that other machine I have not equally carefully checked what is installed, possibly gstreamer-plugins-libav could be missing there, I’m not sure that it’s pulled in automatically)

As said in the original post, just trying to learn the gstreamer framework a bit. And I thought if a commonly used media format does not even play, that’s not a good starting point…

Ah, I had no clue that such beast exists. And the registry in there is 566K. I moved it to hidden place and called the same gst-play-1.0 command as always before. Took quite long to start this time and the new registry is 852K. Yes,and the video is played! Problem solved.

gst-inspect-1.0 output has changed a lot

651c1126
< Total count: 230 plugins, 865 features
---
> Total count: 230 plugins, 1340 features

So the plugins have not changed at all, but libav has gained 475 new features!!!

gstreamer-plugins-libav exists only in packman, not in OpenSUSE. So the wrong version sometimes in the past cannot be the culprit.

But libavcodec57 exists in both OpenSUSE and packman. And from a couple of years ago I believe to remember that their contents (supported codecs) is very different.

So I guess what happened is

  1. When I updated my machine from 13.2 –> 42.1 –> 42.2 some weeks ago, my libavcodec (and some others) from packman got replaced by the OpenSUSE version
  2. I called gstreamer, the registry in the cache was created/updated and only the limited codecs from the OpenSUSE libavcodec got registered.
  3. When I noticed that my multimedia support was crippled after the update I started to vendor changes back to packman. I did those manually over several days, whenever I noticed something that did not work. (Because I did not know the handy zypper dup --from command)
    4.) For some reason gstreamer did not update the registry in the cache after libavcodec had been updated from OpenSUSE to packman. I think both libavcodec version numbers are the same, maybe that’sthe reason why it does not check again?

Not sure whether that is a systematic problem that will always occur when you update libavcodec after gstreamer-plugins-libav has already been used. In that case clearing the cache might deserve mentioning in the sticky items. Or whether it was “just” some unlucky coincidence caused by the order my machine has been updated.

Thanks to everyone who replied!