问题
I am trying to run one of qt sample apps without any modification. It is called player
and it is a multimedia widget demonstration. My system is Ubuntu 16.04 64bit. When I try to play a video, I see the following error in the console:
No decoder available for type 'video/x-h264
Here is the full error after trying two different videos:
Starting /home/aras/Qt5.7.0_Sept2016/Examples/Qt-5.7/multimediawidgets/build-player-Sept2016-Debug/player...
Warning: "No decoder available for type 'video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)constrained-baseline, codec_data=(buffer)0142e01eff0100192742e01ea9101405ff2e00d418041adb7a00f480f55ef7c04001000428de09c8, width=(int)640, height=(int)360, framerate=(fraction)2997/125, pixel-aspect-ratio=(fraction)1/1'."
Warning: "No decoder available for type 'video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)constrained-baseline, codec_data=(buffer)0142e01eff0100192742e01ea9101405ff2e00d418041adb7a00f480f55ef7c04001000428de09c8, width=(int)640, height=(int)360, framerate=(fraction)2997/125, pixel-aspect-ratio=(fraction)1/1'."
Warning: "No decoder available for type 'video/x-h264, stream-format=(string)avc, pixel-aspect-ratio=(fraction)1/1, width=(int)1280, height=(int)720, framerate=(fraction)601600/10033'."
I have pretty much every package remotely related to gstreamer installed. When I run gst-inspect-1.0
I get a lot of output and the last line is:
Total count: 241 plugins (1 blacklist entry not shown), 1388 features
~$ gst-inspect-1.0 |grep x-h264
typefindfunctions: video/x-h264: h264, x264, 264
:~$ gst-inspect-1.0 avdec_h264
Factory Details:
Rank primary (256)
Long-name libav H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 decoder
Klass Codec/Decoder/Video
Description libav h264 decoder
So it looks like to me that everything is installed properly. How come the Qt multimedia example does not work out of the box?
回答1:
I've fixed it by installing the GStreamer Multimedia Framework ffmpeg Plugin on my build system:
Arch:
sudo pacman -S gst-libav
Debian:
sudo apt install gstreamer1.0-libav ubuntu-restricted-extras
回答2:
In you command line interface, run:
ldd /home/aras/Qt5.7.0_Sept2016/Examples/Qt-5.7/multimediawidgets/build-player-Sept2016-Debug/player
ldd echo $(which gst-inspect-1.0)
Look for lines that are referring to GStreamer, for example:
libgstreamer-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
If the lines referring to GStreamer are not the same on both command results, you might have multiple GStreamer installations. Then try to specify a new LD_LIBRARY_PATH
environment variable (DYLD_LIBRARY_PATH
if you run OS-X) that only point to the directory where libgstreamer-1.0.so.0
is located thanks to the second GStreamer ldd
result (gave by ldd echo $(which gst-inspect-1.0)
).
For example, run:
export LD_LIBRARY_PATH="/usr/local/lib:/usr/lib"
来源:https://stackoverflow.com/questions/39607522/no-decoder-available-for-type-video-x-h264