i want to play an avi video with gst-launch command line . I tried the videotest command line :
gst-launch-1.0 videotestsrc ! ximagesink
this command line work fine but if i want to play a video how i can set the file path? My video is located in opt directory.
I am new in gstreamer
Thanks!!
You could use playbin element:
gst-launch-1.0 playbin uri="file:///opt/myvideo.avi"
Related
I'm working with AI-Thermometer project using Nvidia Jeton Nano.
The project is using Pi camera v2 for video capturing.
Here's the command of showing video streams using Pi camera v2.
gst-launch-1.0 nvarguscamerasrc sensor_mode=0 ! 'video/x-raw(memory:NVMM),width=3264, height=2464, framerate=21/1, format=NV12' ! nvvidconv flip-method=2 ! 'video/x-raw,width=960, height=720' ! nvvidconv ! nvegltransform ! nveglglessink -e
I want to use the normal USB webcam (such as Logitech c930) instead of Pi camera v2.
To do so, I need to stream the USB webcam data using GStreamer in the same way as above pipeline commands.
I installed v4l-utils on Ubuntu of Jetson Nano. And tried like this,
gst-launch-1.0 v4l2src device="/dev/video0" ! 'video/x-raw(memory:NVMM),width= ...
, but it gave a warning and didn't work.
How can I show video streams from webcam?
There should not quotes around the device parameter i.e. device=/dev/video0. If the error persists, then its probably something else.
gst-launch-1.0 v4l2src device="/dev/video0" ! \
"video/x-raw, width=640, height=480, format=(string)YUY2" ! \
xvimagesink -e
Hy i tried to play a doorbird live audio stream via gstreamer gst-launch.
I found a code snipped in an fhem server script.
It should be possible with the command gst-launch-1.0 filesrc location=<http://12.0.0.231/bha-api/audio-receive.cgi user=xxxx passwd=xxxx> ! wavparse ! audioconvert ! lame ! filesink location=a.mp3
But i get following error: lame not found. if i change lame to lame lamemp3enc i get the error file not found http://12.0.0.231/bha-api/audio-receive.cgi
What do i wrong?
Gstreamer playbin cannot play my IPCamera mjpeg rtsp with 2048x1534 resolution:
gst-launch-1.0 -v playbin uri=rtsp://admin:admin#192.168.1.100:554/1/1
It shows the following WARNING message:
WARNING: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstRtpJPEGDepay:rtpjpegdepay0: Invalid Dimension 0x1536.
I have also test the following pipeline to force video size:
gst-launch-1.0 -v rtspsrc location=rtsp://admin:admin#192.168.1.100:554/1/1 ! application/x-rtp,media="video",width=2048,height=1536 ! rtpjpegdepay ! jpegdec ! autovideosink
but it complains similar WARNING message.
It should be note that when I change my video encoding to H.264 from camera panel everything is OK with playbin!
I'm trying to open UDP stream video in Raspberry Pi using this pipeline:
VideoCapture video("udpsrc port=5600 ! application/x-rtp,payload=96,encoding-name=H264 !"
"rtpjitterbuffer mode=1 ! rtph264depay ! h264parse ! decodebin ! videoconvert ! appsink emit-signals=true sync=false max-buffers=2 drop=true", cv::CAP_GSTREAMER);
// Exit if video is not opened
if(!video.isOpened())
{
cout << "Could not read video file" << endl;
return 1;
}
However, video.isOpened() return false and I couldn't be able to open with this code. This works on loopback test and another Ubuntu 18.04 PC but RPi 4 (Buster OS) couldn't run it. Also following lines can run upcoming gstream video:
gst-launch-1.0 udpsrc port=5600 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink fps-update-interval=1000 sync=false
Furthermore specific code stack (e.g. [video_udp.cpp][1]) can easily handle video but also it's hard to use with opencv.
NOTE: OpenCV version is 4.2.0-pre
The problem is about using GStreamer library as a plugin of OpenCV. OpenCV doesn't throw exception even you build source code without GStreamer support. (In default, GStreamer library was directly found by Ubuntu, conversely Raspberry Pi 4 couldn't find it.)
Firstly I check build information of OpenCV with std::cout<<cv::getBuildInformation(); in Ubuntu 18.04 machine and found that:
GStreamer: YES (1.14.5)
Also I just check this on Raspberry Pi 4 side and build information was:
GStreamer:NO
Before the build OpenCV I just compare GStreamer plugins with gst-inspect-1.0 command for both of them and I just install some missing plugins like gstreamer1.0-tools . Also I wasn't know the problem, before the checking build information, so I installed some other GStreamer plugins that currently I don't remember.
Lastly, I build system by adding -D WITH_GSTREAMER=ON flag. And now it works well.
I'll edit answer if the problem related to missing plugins those are installed later. For this, I'll check this issue with clean Buster OS image.
I am trying to play a .ts file with Gstreamer-1.0 as well as gst-omx have been successfully installed .
Try to play ts video using below command line format but failed to play.
test#test-Gardenia:~/Videos$ gst-launch-1.0 -v filesrc location= mpeg2.ts ! tsdemux ! mpegvideoparse ! omxmpeg2dec ! videoconvert ! ximagesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstTSDemux:tsdemux0: Internal data stream error.
Additional debug info:
mpegtsbase.c(1347): mpegts_base_loop (): /GstPipeline:pipeline0/GstTSDemux:tsdemux0:
stream stopped, reason not-linked
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
/GstPipeline:pipeline0/GstTSDemux:tsdemux0.GstPad:audio_0044: caps = "NULL"
Freeing pipeline ...
Tried below command also but not did not work.
test#test:~/Videos$ gst-launch-1.0 filesrc location= mpeg2.ts ! tsdemux ! tsparse ! omxmpeg2dec ! videoconvert ! ximagesink
WARNING: erroneous pipeline: could not link mpegtsparse2-0 to omxmpeg2videodec-omxmpeg2dec0
Can any one help me how to play .ts file with mpeg2 codec format using gstreamer