GStreamer: Play mpeg2 - gstreamer

I'm trying to play a local mpeg2 TS file with gstreamer with this:
gst-launch filesrc location=open_season.mpg ! mpeg2dec ! xvimagesink
The first frame appears as big blocks of color and then stops. Any thoughts about what I'm doing wrong here? Does a -TS file need to be handled differently than this?
Here's the log:
$ gst-launch filesrc location=open_season.mpg ! mpeg2dec ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ....
WARNING: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0: Internal data flow problem..
Additional debug info:.
gstbasesink.c(3492): gst_base_sink_chain_unlocked (): /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
Received buffer without a new-segment. Assuming timestamps start from 0.
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 6866757291 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ..

I think first you should first try to play the file with the help of playbin2. If you are able to play it then u should use decodebin2 ,debug its output and construct your pipeline accordingly.
The syntax for playbin2 is as follows :-
gst-launch playbin2 uri = file:///home/user1031040/Desktop/file.mpg
The syntax for decodebin2 is as follows:-
gst-launch filesrc location = file.mpg ! decodebin2 ! autovideosink

Related

Gstreamer: moov-recovery info with qtmux?

I am trying to experiment with Gstreamer and moov-recovery via qtmux.
When I try to get the recovery moov from a non-corrupted .mp4 file
gst-launch-1.0 filesrc location=full.mp4 ! qtdemux ! qtmux moov-recovery-file=moov_recov.mrf ! filesink location=recovered_video.mp4
then I get
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.112361582
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
What is the reason for the Got EOS from element "pipeline0"?
And what would be the correct way to pull the recovery moov from the .mp4 file?
Thanks.
Your muxing process was a success. It took about a tenth of a second. Therefore the EOS. Since it did not crash or anything the file probaly gets removed after a successful muxing. There is no point in keeping that file.

GStreamer opusdec: Try decode Opus bitstream failed

Initial Issue
I would like to use gstreamer plugin opusdec to decode an Opus bitstream. The final purpose is to make glue around it with appsrc and appsink as input/output, to decode 20 ms Opus packets coming from a RTP packet payload and provide PCM sample.
Remark: I can't use gstreamer rtpopusdepay
The following pipeline works:
gst-launch-1.0 filesrc location=testvector01.bit.opus ! oggdemux !
opusdec ! fakesink
In my final application I'm no expected OGG contained data so I did the following:
1) Desencapsulate Opus bitstream
gst-launch-1.0 filesrc location=testvector01.bit.opus ! oggdemux !
filesink location = testvector01.bit.demux
That works. And then:
2) Decode Opus bitstream
gst-launch-1.0 filesrc location=testvector01.bit.demux ! opusdec !
fakesink
and I have the following error:
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2865): gst_base_src_loop (): /GstPipeline:pipeline0/GstFileSrc:filesrc0:
streaming task paused, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ..
Input File
testvector01.bit.opus
From Opus test vector :https://people.xiph.org/~greg/opus_testvectors/
My question is:
What is the proper way to use gstreamer plugin opusec without transport container?
Update
Gstreamer version 1.2.4
As recommended I tried to add opusparse after filesrc and got the following error.
Pipeline is PREROLLING ...
(gst-launch-1.0:5147): GStreamer-WARNING **:
gstpad.c:4555:store_sticky_event:<opusparse0:src> Sticky event
misordering, got 'caps' before 'stream-start'
(gst-launch-1.0:5147): GStreamer-WARNING **:
gstpad.c:4555:store_sticky_event:<opusdec0:sink> Sticky event
misordering, got 'caps' before 'stream-start' Pipeline is PREROLLED
... Setting pipeline to PLAYING ... New clock: GstAudioSinkClock
ERROR: from element /GstPipeline:pipeline0/GstOpusDec:opusdec0:
Decoding error: -4 Additional debug info: gstopusdec.c(460):
opus_dec_chain_parse_data ():
/GstPipeline:pipeline0/GstOpusDec:opusdec0 Execution ended after
0:00:00.063372478 Setting pipeline to PAUSED ... Setting pipeline to
READY ... Setting pipeline to NULL ... Freeing pipeline ...
GStreamer 1.8.1
The following pipeline
gst-launch-1.0 filesrc location = testvector01.bit.demux ! opusparse !
opusdec ! audioconvert ! alsasink
halt here:
Setting pipeline to PAUSED ... Pipeline is PREROLLING ...
Gstreamer 1.13.1
gst-launch-1.0 filesrc location = testvector01.bit.demux ! opusparse !
opusdec ! alsasink
Playback just produce a short audio glitch while no gstreamer error is raised.
gst-launch-1.0 filesrc location = testvector01.bit.opus ! oggdemux ! opusparse !
opusdec ! alsasink
Playback is choppy while no gstreamer error is raised.
Regards,
appsrc is-live=true do-timestamp=true name=audiosrc ! opusparse ! oggmux ! filesink location=test.ogg
gstreamer 1.14.1 works fine
You need to have a parser (opusparse) in between as opusdec doesn’t know what format it is, try the following pipeline:
gst-launch-1.0 filesrc location=testvector01.bit.demux ! opusparse !
opusdec ! fakesink dump=true

converting gstreamer0.10 pipeline to gstreamer1.0

Hello I need to convert a gstreamer0.10 pipeline to a gstreamer1.0 pipeline but don't know much about gstreamer in general.
My 0.10 pipeline is looking like this:
gst-launch-0.10 v4l2src num-buffers=2 device=/dev/video0 ! video/x-raw-yuv, width=3072,height=2048,framerate=30/1 ! ffmpegcolorspace ! jpegenc! multifilesink location=test.jpg
I tried to convert it like this:
gst-launch-1.0 v4l2src num-buffers=2 device=/dev/video0 ! video/x-raw, width=3072,height=2048,framerate=30/1 ! videoconvert ! jpegenc ! multifilesink location=test.jpg
But I'm getting this error when I try to run the pipeline:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2865): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming task paused, reason error (-5)
Execution ended after 0:00:00.473942184
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
Thanks for any help on this

Gstreamer. PCM streaming

I have a pcm audio file that I want to stream via rtp. When I do
gst-launch-1.0 filesrc location=AudioRaw515151.pcm ! audio/x-raw, format=S16LE, channels=1, layout=interleaved, rate=8000 ! alawenc ! rtppcmapay ! udpsink host=192.168.2.5 port=5010
I have that kind of message
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.019270487
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
But I can play this audio, That means that audio is ok.
gst-launch-1.0 filesrc location=AudioRaw515151.pcm ! audio/x-raw, format=S16LE, channels=1, layout=interleaved, rate=8000 ! alawenc ! rtppcmapay ! rtppcmdepay ! alawdec ! audiosink
I tried to take another file-avi file, take audio from it and maked the same thing
gst-launch-1.0 filesrc location=file.avi ^
! qtdemux name=mux^
! queue ^
! faad ^
! audioconvert ^
! audioresample ^
! "audio/x-raw, layout=(string)interleaved, rate=(int)8000" ^
! alawenc ^
! rtppcmapay ^
! queue ^
! udpsink host=192.168.2.5 port=5010
As you see, this the same thing but with audio from avi. Everything works.
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
When I open Wireshark I see that when I run my pipeline with PCM, it fires all data without any delay and in every packet that I send is:
Header checksum: 0x0000 [incorrect, should be 0x40b5 (may be caused by "IP checksum offload"?)]
Message: Bad checksum
So here is a question. I think that I have a problem with timestamps or something like that, when I do !alawenc (encoding to G711), I am right?
And what solution can fix that problem?
First Question. Does the 2nd example play?
A few more comments:
file.avi and qtdemux sounds wrong, just use decodebin (or uridecodebin) to leave the pligging to gstreamer.
for raw audio I recommend to use the audioparse element
And finally there are a bunch of rtp examples in the git repo:
https://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/rtp/client-PCMA.sh

gst-launch with tcpserversink not working

I am trying to user gst-launch to stream mp3 audio over tcp, this is what I am trying :
$ gst-launch-0.10 filesrc location="/path/to/file.mp3" ! tcpserversink host=0.0.0.0 port=3000
but it doesn't work the output is as follow :
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstTCPServerSink:tcpserversink0: Internal GStreamer error: negotiation problem. Please file a bug at http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer.
Additional debug info:
gstmultifdsink.c(2700): gst_multi_fd_sink_render (): /GstPipeline:pipeline0/GstTCPServerSink:tcpserversink0:
Received first buffer without caps set
Execution ended after 94657 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ..
Whats the problem where I am going wrong?
I did lots of search on internet but didn't found the right document how to use gst-launch properly. if anyone can please point me to right doc or tell me how to use it it will great.
tcpserversink complains about missing caps on its sink pad:
Received first buffer without caps set
This is because tcpserversink wants to know what it sends.
One way to tell it would be to manually decode and re-encode the stream:
gst-launch-0.10 filesrc location="/path/to/file.mp3" ! mad ! audioconvert ! lame ! tcpserversink host=0.0.0.0 port=3000
But that's just waste of CPU power.
There's an element called mpegaudioparse that (apart from some other stuff) figures out the details of the mpeg stream and sets its output caps accordingly. By simply putting it between your filesrc and the tcpserversink you'll end up with a working pipeline:
$ gst-launch-0.10 filesrc location="/path/to/file.mp3" ! mpegaudioparse ! tcpserversink host=0.0.0.0 port=3000