I'm building the custom yocto image for iMX8m mini.
It builds gstreamer-1.18.5.imx
At first, I am seeing video4linux2 shared lib was installed in rootfs with default package configuration options as mentioned at gstreamer1.0-plugins-good_1.18.5.imx.bb
The build succeeded.
But on the target board the $gst-inspect-1.0 | grep v4l2 only outputs 3 plugins:
v4l2src
v4l2sink
v4l2device...
I'm actually looking forward is below video decoder plugins-
I don't have it and I don't really understand why it's not there whereas the yocto recipes have all succeeded.
Can anyone suggest something which I have to look for to fix this issue
Related
I want to make a transcoding video app from h.264 to h.265.
I have a problem with libavcodec library. I have this library in my project, all function is working, but when i'm trying to set codec :
avcodec_find_decoder_by_name("libx265");
function couldn't find it. Hovewer, when i give "hevc" instead of "libx265" function is working, but it's not the same.
Please for help :)
There is no decoder named libx265
libx265 is only an encoder.
FFmpeg has a native, built-in HEVC/H.265 decoder
It is named hevc. You don't have to do anything special to include or enable it.
There are also several hardware accelerated HEVC decoders that may be available for your system: hevc_cuvid, hevc_mediacodec, hevc_qsv, hevc_rkmpp, and hevc_v4l2m2m.
ffmpeg has implemented codecs (lets call them builtin) and wrappers to third party codecs. It seems/could be that the h265 codec is just a wrapper, that means you have to install a h265 decoder. Besides, did you specify the h265 codec when you configured ffmpeg? Did you build it yourself or pre build via package manager?
Try 'ffmpeg -decoders' at the command line and search for h265.
I would like to use qmlgl plug-in (qmlglsink, qmlglsrc) in my application, but it is not available in the image.
Also, my environment is ARM-based board - Phytec_nunki.
gst-inspect-1.0 | grep qml does not receive any result.
I use Yocto for building images. As I understand from this link - qmlgl is located in "GStreamer Good Plug-in" bunch, but it is not enables by default.
I inspected the sources of gstreamer which is downloaded by Yocto - the files with "qmlgl" are there. So I guess I have to enable it in some config file.
I tried to add
CORE_IMAGE_EXTRA_INSTALL += " \
gst-plugins-good-qmlgl\
"
into my local.conf file. Bitbake was executed successfully but the plug-in was not appeared.
So, does anyone have an idea for solving it?
#UncleSav using your own layer, do:
Example your layer is meta-xpto.
meta-xpto/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_%.bbappend
Inside the .bbappend add:
inherit qmake5_paths
PACKAGECONFIG[qt5] = '--enable-qt \
--with-moc="${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/moc" \
--with-uic="${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/uic" \
--with-rcc="${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}/rcc" \
,--disable-qt,gstreamer1.0-plugins-base qtbase qtdeclarative qtbase-native'
PACKAGECONFIG_append = "qt5"
With this change, we inform gstreamer1.0-plugins-good that we want to compile with the qt flag and inform the necessary dependencies.
Additionally, if you are using i.MX8 with newer BSPs especially with 5.x Linux kernel, the packageconfig option should be:
QT5WAYLANDDEPENDS = "${#bb.utils.contains("DISTRO_FEATURES", "wayland", "qtwayland", "", d)}"
PACKAGECONFIG[qt5] = "-Dqt5=enabled,-Dqt5=disabled,qtbase qtdeclarative qtbase-native ${QT5WAYLANDDEPENDS}"
PACKAGECONFIG_append = "qt5"
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 having trouble being able top open any video files in OpenCV besides those encoded in MJPEG.
I have installed OpenCV using this script (which should compile OpenCV with support for ffmpeg) and an testing using the sample provided here.
When running with a h264 encoded video I get:
[mov,mp4,m4a,3gp,3g2,mj2 # 0x123ed80] multiple edit list entries, a/v desync might occur, patch welcome
[h264 # 0x12465e0] A non-intra slice in an IDR NAL unit.
[h264 # 0x12465e0] decode_slice_header error
Could not open the output video for write: test.mp4
When running with an MPEG-2 encoded video I get:
[mpegts # 0x1e92d80] PES packet size mismatch
[mpegts # 0x1e92d80] PES packet size mismatch
[mpegts # 0x1e92d80] max_analyze_duration reached
[mpegts # 0x1e92d80] PES packet size mismatch
Could not open the output video for write: test.mpeg
I am running x64 Ubuntu 12.04.
EDIT: I tried OpenCV 2.4.8 on a Ubuntu 13.10 x86 VM, ffmpeg works fine, however the sample code still fails, this time with the following error:
[h264 # 0x849ff40] A non-intra slice in an IDR NAL unit.
[h264 # 0x849ff40] decode_slice_header error
Could not find encoder for codec id 28: Encoder not foundOpenCV Error: Unsupported format or combination of formats (Gstreamer Opencv backend doesn't support this codec acutally.) in CvVideoWriter_GStreamer::open, file /home/dan/Install-OpenCV/Ubuntu/2.4/OpenCV/opencv-2.4.8/modules/highgui/src/cap_gstreamer.cpp, line 505
terminate called after throwing an instance of 'cv::Exception'
what(): /home/dan/Install-OpenCV/Ubuntu/2.4/OpenCV/opencv-2.4.8/modules/highgui/src/cap_gstreamer.cpp:505: error: (-210) Gstreamer Opencv backend doesn't support this codec acutally. in function CvVideoWriter_GStreamer::open
I am not sure about the main reason for this. But I guess this problem is relate to the decoder installed on your system. According to the install script from github, it removes your ffmpg and x264 then rebuilds them from source code. Before testing your OpenCV code, try simple "ffmpeg" command on your test video.
Such as: ffmpeg -i inputfile.avi -f image2 image-%3d.jpeg
The script you have used is quite old and installs old version of OpenCV (2.4.2, while the latest stable is 2.4.8), try to use this script - https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/2.4/opencv2_4_8.sh or install OpenCV and ffmpeg on you own.
As rookiepig mentioned - check whether ffmpeg is working.
Try to use different codec - here http://www.fourcc.org/ is full list of options, of course testing all of them is useless - jsut try the most popular codecs.
I know that it's stupid, but on Windows some codecs works only in release mode(okay, probably they are working in both modes, but on my machine they used to work only in release mode). Try to compile you program in both modes and check whether there is some difference.
And show us you code, maybe there is something wrong in it.
I am working on ubuntu. I have a file.h263 and I don't know how to play it. I've tried ffmpeg -f msg0001.h263 -i file.avi but it didn;t work. Need some help please. I want to convert file.h263 in .avi or mp2 in order to play the file in an android phone. Got any advices? It would be best to have a c++ code. but i didn't find any example, nothing at all.
Please help. If you have a piece of code that does this I would appreciate.
Thx
You should be able to play H263 file and convert it to AVI as the following:
ffplay -i file.h263
ffmpeg -i file.h263 file.avi
For android playback you can keep video stream in H.263 and convert the file to 3GPP (.3gp) or MPEG-4 file format or change file format and codec to MPEG-4 and H.264. For example:
ffmpeg -i file.h263 -vcodec copy -f 3gp file-h263.3gp
ffmpeg -i file.h263 -vcodec h264 -f mp4 file-h264.mp4
See Android supported media formats for more information.
.h263 is old yet great format, and if your software player uses HW accelration to play video that majority of old videocards (including Nvidia, ATI) will provide you HW accelration for video playback for .h263 format files... now various use .h264 format... thus try to convert videos to .h264 format instead of avi...
i think what you are facing is a extension delima .... try renaming it to MP4, then various player will play it without problems..
you can also use vlc.. one of the best video players ever...
Beside GStreamer can play H263 files , and with gstreamer pipelines you can convert various format on flies...
though i usually use Handbreak to convert video files /DVD's, and it is available on windows, Mac as well as on linux ....
P.S. in Gstreamer, you might need to install plugins, install all 2... good, bad and ugly plugin. i am not sure in which .h263 comes in, but must be in one of these three......