what is "engineName" property in TI gstreamer plugin TIVidenc1 - gstreamer

What is "engineName" property in TI Gstreamer plugin TIVidenc1?
And what values it can be?
(I know only codecServer... what else it can be?)

By documentation of TI(not too much explanation):
Engine name used by codec combo.
Here are some good examples of usage.
I have seen also this value
encode (used in network streaming but also H264 encoding to file)
With element TIVidenc I seen also:
- hmjcp (used with H264 encoding)
You can use gst-inspect TIVidenc1 to check the values (hope they are listed there) if you have installed this plugin/expansion or whatever it is..
also if you are keen you can check the sources

Related

Add TOC chapters to MP4 with GStreamer 1.18 (VS2015)

How can I add chapters to MP4 files with GStreamer 1.18?
I have a Visual Studio 2015 C++ project that writes a video (H264) and audio (aac) stream to the disk using mp4mux. Now I would like to add chapters to the MP4 file that are compatible with regular video players like VLC.
I have tried to follow the documentation to create a GstToc and a dummy GstTocEntry, but it doesn't appear to be written to the file:
GstToc* toc = gst_toc_new(GstTocScope::GST_TOC_SCOPE_CURRENT);
GstTocEntry* new_entry = gst_toc_entry_new(GstTocEntryType::GST_TOC_ENTRY_TYPE_CHAPTER, "some_uid");
gst_toc_entry_set_start_stop_times(new_entry, 0, 50);
gst_toc_append_entry(toc, new_entry);
I then also tried to generate a new toc event and pass it to the video GstElement vin:
gboolean result = gst_element_send_event(vin, gst_event_new_toc(toc, true));
Did I miss anything in order to map the GstToc to the video stream? Do I need to tell mp4mux to process the toc? Or is this not supported?
GStreamer documentation seems to imply, that there is GstToc support in mp4mux:
Below hollow bullet point o indicate no support and filled bullets ***
indicate that this feature is handled.
MP4: * elst
The elst atom contains a list of edits. Each edit consists of (length, start, play-back speed).
I didn't find much on the elst atom or what an edit is. I tried using GST_TOC_ENTRY_TYPE_EDITION instead of GST_TOC_ENTRY_TYPE_CHAPTER, but that didn't change anything.
This page mentions "preliminary code in MP4 supporting chapters" in GStreamer.
I have seen ways to inject metadata files into existing mp4 files with ffmpeg and other tools which are not available on our system unfortunately. I could try to inject the chapters into the mp4 file header manually, but I'd very much like to avoid this post-processing step for obvious reasons. Any help would be greatly appreciated!

ffmpeg: test if format is seekable

How do i test if a format is seekable?
I have written code against the latest fmmpeg's (4.4) libavformat, libavcodec, etc. My code reads and decodes video files. Now i also want to support reading from avdevices, such as dshow (DirectShow) on Windows. That is possible through the same interface as i have already implemented, it just requires using the dshow format. Super nice! But in my video file reader, i have some seek logic implemented, which is engaged in various instances. The problem is that the dshow format is not seekable (avformat_seek_file() returns -22, invalid argument). How do i detect that a format is not seekable? I know that the AVFormatContext's pb member (AVIOContext) has a seekable field, but the dshow format leaves pb null (as it should be since the AVFMT_NOFILE flag is set for the format). How do i test if a format is seekable (so that if it is not, i can disable the seek logic)? The implementation of avformat_seek_file() and the various functions it calls seems to have various callbacks, so i am not sure if simply this would do the trick: bool isSeekable = !!context->pb && context->pb->seekable!=0.

WIC HEIF HEIC image decoding C++

Windows Imaging Component is used for decoding heif images. However extra apps from the microsoft store (heif image extension, hevc video extensions) are required for a successful decoding of the images.
Without them the WIC api returns blank image. Now I want to be able to programatically determine whether the heif file can be correctly decoded.
I have tried to locate the existence of required decoder type using DXVA Checker which is supposed to be WIC_HEIF_Decoder. But I can't find it registered anywhere.
There is a GUID key however CLSID_WICHeifDecoder documented here which I think can be registered in the system even if the decoder is missing.
Does anyone have any idea how to do this?
If you plan to use WIC decoder, you should rather use WIC API to check the availability and not Media Foundation API, even if both decoders are known - at the moment - to be packaged together and belong to the same Windows Store application (extension).
You should be able to use IWICImagingFactory::CreateComponentEnumerator to enumerate decoders and identify if HEIF is among the available ones.
Microsoft HEIF Decoder
Class Identifier: CLSID_WICHeifDecoder
Signing Status: WICComponentSigned
Author: Microsoft
Vendor Identifier: {F0E749CA-EDEF-4589-A73A-EE0E626A2A2B}
Version: 1.0.0.0
Spec Version: 1.0.0.0
Friendly Name: Microsoft HEIF Decoder
IWICBitmapCodecInfo:
Container Format: GUID_ContainerFormatHeif
Pixel Formats: GUID_WICPixelFormat32bppBGR
Color Management Version: 1.0.0.0
MIME Types: image/heic,image/heif,image/avci,image/heic-sequence,image/heif-sequence,image/avcs,image/avif,image/avif-sequence
File Extensions: .heic,.heif,.avci,.heics,.heifs,.avcs,.avif,.avifs
Patterns: 576
You might prefer to use IWICImagingFactory::CreateDecoder with GUID_ContainerFormatHeif because you should be more interested in ability to decode rather that in specific decoder implementation.
Check for specific CLSID is trivial, using either registry query or direct CoCreateInstance call but it does not make much sense for the specified task.
Since the HEIF decoders are still recognized on Windows that can't decode them this is the best hack imo:
In order to decode HEIF images HEVC video extension should be installed on the machine.
So the right check is to see if there is any decoding type matching the HEVC input
MFStartup(MF_VERSION);
IMFActivate** activate {};
unsigned int count {};
// Set the HEVC GUID
MFT_REGISTER_TYPE_INFO input;
input.guidMajorType = MFMediaType_Video;
input.guidSubtype = MFVideoFormat_HEVC;
// Get all available output types for HEVC input
MFTEnumEx(MFT_CATEGORY_VIDEO_DECODER, MFT_ENUM_FLAG_SORTANDFILTER | MFT_ENUM_FLAG_SYNCMFT, &input, nullptr, &activate, &count);
// Release interface pointers
for (size_t i = 0; i < count; i++) {
activate[i]->Release();
}
CoTaskMemFree(activate);
MFShutdown();
return (count > 0);

Read H.265 and VP9 frame?

I'm trying to compare 3 videos that are encoded by H.264, H.265, and VP9.
All of them are made by a same YUV video.
I want to use OpenCV's function to read each frame of the video and do some comparison:
VideoCapture vCap1, vCap2, vCap3;
vCap1.open("h264.mp4");
vCap2.open("h265.mp4");
vCap3.open("vp9.webm");
Mat frame1, frame2, frame3;
while (vCap1.read(frame1) && vCap2.read(frame2) && vCap3.read(frame3))
{
//do something
}
The vCap1 opened successfully, but vCap2 and vCap3 won't open.
Did I miss something to include to make it work?
Or OpenCV even not support the other 2 formats?
After using google :-) I found that
http://answers.opencv.org/question/10741/videocapture-format-supported-by-opencv/
Especially you have the needed codecs installed on your system. You can visit also
http://www.fourcc.org/codecs.php
for codecs.
The documentation from OpenCV is indeed not very helpful. :-)
What I would try if you are running under linux:
strace -xfo dump
and take a look in the system calls. Maybe you can find some hints of missing codec files, used configuration files and or other failed system function calls. If so, you have a startpoint.

list file extensions supported by OpenCV

In OpenCV, I see imread() and VideoCapture() both take a string to a file path of multiple extensions. Is there a way to get a list of extensions that are supported by them? For example, getting a list of "jpg", "png", "mov", "mpg", etc.? I assume this is system dependent and others have needed to query this at runtime.
Furthermore, how is support determined? If have something like the below code and the Mat I get back always seems partially corrupted (I can see a bit of the image). It doesn't seem to change regardless of the frame number I ask for. I can play this video in my video player "totem", but I'm not even sure if totem and OpenCV are even using the same codec for this file.
Mat fromVideo(std::string _videoPath, int frame) {
VideoCapture capture(_videoPath);
Mat f;
for (int i = 0; i < frame; i++) {
capture >> f;
}
return f;
}
For imread() (more info here):
Windows bitmaps - *.bmp, *.dib (always supported)
JPEG files - *.jpeg, *.jpg, *.jpe (see the Notes section)
JPEG 2000 files - *.jp2 (see the Notes section)
Portable Network Graphics - *.png (see the Notes section)
Portable image format - *.pbm, *.pgm, *.ppm (always supported)
Sun rasters - *.sr, *.ras (always supported)
TIFF files - *.tiff, *.tif (see the Notes section)
For VideoCapture():
AVI files - *.avi
It seems that AVI is the only format with decent cross-platform support. See here for more info.
Use the method cv::VideoCapture::isOpened() to make sure that the constructor was successful in initializing the VideoCapture object.
Note that even if it was possible to get a list of supported container formats from OpenCV (AVI, MKV for instance) with their typical filename extensions, you would still need to know the exact list of supported codecs (and even then the exact file you want to open might be corrupted, etc...). So a list of filename extensions is not enough to accurately describe what is internally supported by OpenCV, and the simplest solution at the OpenCV API level is this isOpened() method.
Just update:
cv::VideoCapture cap("D:\\test.mp4")
works for me.