Is there any easy way to get from original video detailed information as duration and frame rate??
I have to divide originalvideo to single frames and to do it I want to use NReco.VideoConverter but I in the API I could not find function which allows me to get video properties. If there is not possibility to do it, can you recommend me other useful .net wrapper to FFMpeg?
I saw of course Using FFmpeg in .net?
and Solid FFmpeg wrapper for C#/.NET but there are recommended wrappers which are quite old or have only basic functions. I look wrapper which allows me to get details from original video, divide it to single frames (i need to improve quality) and concat it to new one avi or other file of course with audio with possibility to change paramters(resolution, frame rate etc..)
Maybe this can help, it shows a way to get all metadata form a file using Windows Media Format SDK 11:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd743789(v=vs.85).aspx
Related
I have a sequence of images that I was able to extract from a video using LibVLCSharp. This sample to be more specific. I'm creating a small video library manager for learning purposes, and I would like to extract frames and create thumbnails to play when the user hovers the mouse over the previewer.
Using the aforementioned sample I was able to create a WPF UI around the same loging and extract the frames from a video file. However what I want now is to convert these extracted frames into a video file, using them as preview for the video, just like happens on YouTube.
I wasn't able, however, to find out how to achieve this using LibVLCSharp or just LibVLC. Using this answer on Super User I was able to achieve my goal and put those frames together into a video using ffmpeg.
I haven't taken the time yet to study FFmpeg.Autogen, so I don't know if I would be able to extract the frames from the video files in the same way I can do with LibVLCSharp, but I don't see with good eyes using both libraries on my application, one to export the frames and one to generate these frames into a video.
So, is there a way to get the output frames and convert them into a playable video using LibVLCSharp (or libvlc) itself?
I don't see with good eyes using both libraries on my application
You already are, LibVLC ships with ffmpeg.
So, is there a way to get the output frames and convert them into a playable video using LibVLCSharp (or libvlc) itself?
It is possible that there is a way, but I cannot find it right now. Using libvlc for this would be awkward and an inflexible solution. I would use ffmpeg.
You are not forced to use FFmpeg.Autogen for conversion scenarios you can achieve with ffmpeg.exe. I would start a ffmpeg process to do the conversion, and read the ffmpeg stdout for the video data, if you don't want to save it somewhere.
I think there is a way to play images at a specific rate (look at the VLC CLI options), but I don't know how well it works as I never used that
recently i have started workin on project of my own which is capturing a camera output using DirectShow .Net. There are few problems that i don't know how ot solve
1) How can i encode the captured stream into H.264 format.I understand i should some how add filter in the filter graph. But i wasn't able to find where and how . Also i was not able to find if there is standart H.264 filter or should i download it form some where? If i need to download it can it just be a dll to wich i add reference or should it be installer?
2) Is there a way to save the captured output into a memory object, some kind of stream or it can only be written to file?
Best Regards,
Iordan
You're can use commercial software from VisioForge or Viscomsoft.
AForge potencial problem - no audio during capture, only video. Also output formats is a very limited. But - it's free and open source, if you're have any DirectShow experiense you can add audio support.
You will need to use something like FFMpeg or Handbrake. Check out http://vidcoder.codeplex.com/.
AForge also has some video editing abilities and you can also pass filters to it. There are also several FFMpeg C# wrappers you could use such as https://github.com/crazyender/FFMPEG.net
You should use AForge.net. All of the hard work is done for you already. Use VideoFileWriter http://www.aforgenet.com/framework/docs/html/4ee1742c-44d3-b250-d6aa-90cd2d606611.htm. I appears that the AForge framework uses FFMpeg under the hood as well (See AForge.Video.FFMPEG namespace). You just create a writer and pass it the bitmap/frame writer.WriteVideoFrame(bitmap);
You should fully investigate the video abstractions in AForge. You could save yourself considerable amounts of time.
Example: http://www.aforgenet.com/framework/samples/video.html
1) Yes, You should download encoder filter library. Most of decoders are supplied with free. But encoder is not. If you don't want to pay, you have to find open source Encoder.
And To use at the graphedit program, you should do dll register with that dll file. Or the installer program do this instead. And you also need to check container type like mp4, mkv... In other words you need mux filter to save that in a file. I think someone will link available urls. Sorry I don't have urls now.
2)What is that the means of capture? Is that Movie? or Image?
In case of Image, There are many sample projects and SampleGrabbers. You can save it to both of a file and memory.
In case of Movie, I'm sure your pc memory is not enougth to them with out encoding. Make memory stream and pass it to capture manager.
You can also make a filter in order to customize filter to your needs. All of information are included in Windows SDK samples.
I have a video analytics program that processes assorted frames from a video. (Several hours long)
The video is likely going to be an MP4 but may be other formats going forwards.
At the moment, I have a C# wrapper around an ffmpeg call to extract an individual frame at the requested time. (I'm using the ffmpeg.exe binary. Not the libraries directly)
At the moment, this all works. But it's slow. Very slow.
I've found ways to improve the speed by storing the extracted frames in a ramdisk while they're being processed. Changing the stored image format etc...
I just wanted to check if anyone could think of any way to pull individual frames out. At split-second accuracy.
I know this is probably possible with DShow etc... I went straight to FFMPEG as I've used it before. But if DShow is likely to be faster I'll gladly change!
In Windows you have native APIs to process, and in particular read from, media files:
DirectShow
Media Foundation
Both provide support for MP4 (H.264 video), DirectShow as a framework extended by third party MP4 Demultiplexer and H.264 decoder (of needed, also Windows 7 provides build it), and Media Foundation - natively or extended by third party extensions depending on OS version.
Both can be interfaced from .NET via open source wrappers DirectShow.NET and Media Foundation .NET respectively. This works out way faster then FFmpeg CLI for individual frames. Also note that you would be able to obtain frames incrementally without need to locate specific time and do excessive duplicated work, not even to mention process startup/initialization overhead. Alternatively you could use FFmpeg/Libav binaries through wrapper into C# and get similar performance.
You can change the position of the offset parameters. The order matters for the speed if the video contains valid meta data you can seek through the video faster.
If you put the offset before the input file the offset will be calculated with the bit rate with is not every time exactly (in case of a variable bit rate), but it is much faster. The correct way is to walk through the video (offset parameter is after the input file) but this takes time.
Hello I am working on video files and would like to learn video's length, frame width and height, and total bitrate. I have seen solutions for ID3 tags but they don't seem working for movies(.mov extension)
Find and download/buy ISO/IEC 14496-12 (MPEG-4 Part 12)
The mvhd and tkhd boxes (and possibly others... it's been a while!) will give you the information you're looking for. The MOV file format is quite easy to parse.
Provided that the file is playable within DirectShow, you can build a pipeline for this file and without running it check the pipeline properties to find out details like duration is resolution. This method is not specific to .MOV and works out well for other formats. In C# you typically interface to DirectShow via DirectShow.NET.
See related:
Grab frame from .mov file using DirectShow.net
Getting MP4 File Duration with DirectShow
how to get the duration from a mp4 media file by C#
In my opionion the best way is use of MediaInfo. It not requires any additional codecs installed etc.
See my answer in this post:
unable to load MediaInfo Library
I want to make a program that takes an MP3 file and breaks it into many smaller mp3 files based on 1-2 seconds of no sound (silence).
What is the easiest way to do this in c#?
Bass library. Bass has everything you need. It can access, record and edit media streams like mp3s, allowing you to sample the volume at different time points. It has a .net api, so you can use it in c#. Unfortunately it does cost money if you are using it for a commercial application, but they do provide a free non-commercial license.
Sox is a command-line tool which has an option to split an mp3 on n seconds of silence. You could always use the system command to call sox from c#.
Other related links.
Ripping a CD to mp3 in C# - third party component or api out there?
Audio Libraries for MP3 editing
How do I merge/join mp3 files with c#
This code shows a way to make a CD
ripper in C#. There are APIs from some
vendors that allow reading audio CD
tracks but it is also possible to do
it using APIs that allow low level
access to CD drives such as ASPI from
Adaptec or IOCTL control codes. The
latter method is used in this case,
because there is no need to install
any third party software, it is
completely covered by Win32 API
functions.
http://www.codeproject.com/KB/cs/csharpripper.aspx
Splitting the MP3 stream will be difficult to do with any degree of precision. The compressed MP3 data exists as sequential chunks of audio data comprised of many samples. The easiest way to perform this would be to decode the stream either progressively or in its entirety, perform your manipulation, then re-encode it (which as I understand is how most jukebox software does it)
Having a solid knowledge of the file's binary format would be a good place to start. That done, you'll know what silence looks like in the file. You may have to define exactly what silence is. Presuming that, like most audio, it started from an analog source, there's almost certainly some noise buried in the "silence". What will your tolerance for ambient/background noise be?
Once you know what you're looking for, just scan through the file, looking for "it".
Simple ...
A program to do this already exists:
http://mp3splt.sourceforge.net/mp3splt_page/home.php