Simple encode and decode pipeline with gstreamer?
Asked Answered
S

4

5

I'm trying to create a simple gstreamer1-0 pipeline that encodes and decodes h264 a webcam feed hopefully using the most basic elements possible. I already have (theoretically) all standard, good, bad and ugly gstreamer libraries installed. I used the word "Theoretically" because I don't have root privileges and I have to request IT to download/install every single library I might need and it's quite a pain.

I've tried the following pipeline but it didn't work:

gst-launch-1.0 v4l2src ! autovideoconvert ! x264enc bitrate=256 ! decodebin ! autovideosink 

I get the following output:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
Missing element: H.264 decoder
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0: Your GStreamer installation is missing a plug-in.
Additional debug info:
gstdecodebin2.c(3977): gst_decode_bin_expose (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0:
no suitable plugins found
Execution ended after 0:00:01.795803500
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

So according to that I'm missing a block to my plugin to decode h264 right?

Now I've read this forum and I've no idea how to install the decoder block. If somebody can explain to me how to do that in order to get that simple pipeline running?

Saxena answered 17/4, 2017 at 15:21 Comment(0)
D
14

You might be missing h264 decoder plugin. You can check it with

gst-inspect-1.0 | grep 264

The decoder that's generally used is avdec_h264

This will list the plugins related with h264. If you don't have any decoders you'll want to install gst-libav packages.

Dietetics answered 18/4, 2017 at 7:29 Comment(4)
Yea, I tried that and I didn't see it... Most grateful for the avdec_h264 and gst-libav package information. I will look into that. Will avdec_h264 word with x264enc block or do I have to use the matching avdec_h264 encoding block? EDIT: this is what I get when I do inspect: x264: x264enc: x264enc rtp: rtph264depay: RTP H264 depayloader rtp: rtph264pay: RTP H264 payloader videoparsersbad: h264parse: H.264 parser typefindfunctions: video/x-h264: h264, x264, 264Saxena
Yes you're lacking a h264 decoder. avdec_h264 will work fine with x264enc. I guess gst-libav package has another encoder for h264 but x264enc is ok.Dietetics
Awesome, many many thanks... I'll try it out and get back to you as soon as I can... btw, how do I select the answer? is it necessary if there's only one? xDSaxena
You're welcome. It's better to select the answer to let other people having same problems know that it worked for you even if there's only one answer. ( meta.stackexchange.com/questions/5234/… )Dietetics
B
2

In centos 7, you can install it via yum:

sudo yum install -y http://download1.rpmfusion.org/free/el/updates/7/x86_64/g/gstreamer1-libav-1.10.4-2.el7.x86_64.rpm

and then check it again:

gst-inspect-1.0 | grep 264

now you can see the decoders

Bosnia answered 18/2, 2020 at 16:40 Comment(1)
by the way, check the versionBosnia
C
1
gst-launch-1.0 videotestsrc num-buffers=10 ! x264enc ! avdec_h264 ! videoconvert ! autovideosink

Please note videoconvert is required to show the video.

Croup answered 11/1, 2022 at 2:14 Comment(0)
S
0

All encoders produce standard-compliant video stream, and all decoders can accept standard compliant encoded video stream. So, it does not matter which encoder/decoder combination you use. Any combination should work.

Siege answered 6/12, 2022 at 8:20 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.