I'd like to process a directory of mpg's in a batch to have a thumbnail using C#/.NET.
Does anyone have any good suggestions on how I could do this?
I know it's not C# .NET but ffmpeg is a great tool to do exactly this. Can be run as a command line tool from any language.
Here's a small tutorial to get you started.
I did this a few years ago, but I seem to have lost the source. Anyway, the route-of-least-resistance I found was to use DirectShow, there is an interop wrapper for managed code, namely directshow.net. You'll want to use IMediaDet's GetBitmapBits from the Windows Media Format SDK.
There is an example on CodeProject: Extract Frames from Video Files
Related
I've searched without any luck about how this can be done in C#. What i'm trying to archieve is a program that accepts video files and converts them to H.264. Here is an example of a page where you can do this interactively:
http://www.ofoct.com/video-converter/convert-to-h-264-video.html
Question:
How can I in .NET create a program that can do something similar to whats being done from that homepage I shared? Any help or input is highly appreciated, thanks!
EDIT:
The reason i want to do this is because it seems like videos play in both iOS and Android devices when this is done, perhapps there is another way to make sure videos can play in both iOS and Android?
EDIT again:
Lets say i film a Video on a phone Android/iOS, now I'm using a ASP.NET web api that I'd like to convert theese movies to H.264 before storing in Azure, Is this possible? If so, any pointers on how?
There is a wrapper available http://www.ffmpeg-csharp.com/
The main point is that no one is going to write an encoder due to how slow it would be in .NET
Encoding/decoding are provided by the OS, through Direct Show (in the past) or Microsoft Media Foundation. For example, the Microsoft Media Foundation already contains a [H.264 Video Encoder](H.264 Video Encoder).
The SDK is appropriate for C++ and Microsoft hasn't released a wrapper. There are wrapper projects available though, eg. MF.Net, DirectShow.NET, WindowsMedia.NET although it doesn't have any activity since 2012.
There are also similar questions in StackOverflow, that propose other options, like using Microsoft's Encoder, although H.264 support is available only in the Pro version
The only plausable way would be to call out to an encoding application such as ffmpeg.
I'm not sure that this what you need but you can download a nuget called
NR.VideoConverter :> then you can write this code to convert the type of video
like from mp4 to mvo or anything I'm not sure what is h264 but I did find it when I wanted to change my videos so it could help y
var converter = new NReco.VideoConverter.FFMpegConverter();
converter.ConvertMedia(FilePath, FilePath, NReco.VideoConverter.Format.h264);
I have a desktop application (mfc) in which now I have to implement split and merge of MP4 videos. I have searched a lot and found almost nothing online. Please help me with some hints on how to proceed and what to use. Splitting and merging should be done on timeline basis and not based on size. Code is in VC++
Can I achieve this with Windows Video Encoder? If yes, how to know about the exposed methods in WME?
DirectShow (now part of Windows SDK) provides editing services (EDS) but I would suggest ffmpeg (http://ffmpeg.zeranoe.com/builds/) as a better choice since it would support wider range of formats (e.g. H.264 - http://msdn.microsoft.com/en-us/library/windows/desktop/dd390353(v=vs.85).aspx).
I want to make a program which takes video and audio and merges them. Video type or audio type is not important for me. How can I make this? Does any library exist for this? I know there are many programs about this topic but I want to learn how to implement such a program.
The technical term for what you are trying to do is 'multiplexing', and commonly referred to as 'muxing'.
FFmpeg is a multiplatform command line tool that does this, and arguable the industry standard. Many projects wrap FFmpeg into libraries and GUIs.
FFmpeg is also open source, so you can download the code and see how they have done it. That siad, it is very big and complex.
If you are interested in the actual mechanics of muxing separate audio and video files together into a destination file, then you will need to learn much about container formats and Codecs.
Look at some sort of FFMPEG wrapper in C#.
An easy way to multiplex audio and video on linux is to use gstreamer. Here's a A/V pipeline that you can create using gst-launch on a shell prompt.
filesrc location=file1.vid ! queue ! mux. filesrc location=file2.aud ! queue ! mux. avimux name=mux ! filesink location=output.avi
Replace file1.vid with the name of your encoded video file and file2.aud with the name of your encoded audio file. output.avi is the container file that you need.
I have been doing a lot of searching today for C# libraries which will allow me to create H.264 encoded video files. Does anyone know if any such libraries or 3rd party components exist?
Use ffmpeg. I suggest to run a ffmpeg process directly, like in this sample: http://jasonjano.wordpress.com/2010/02/09/a-simple-c-wrapper-for-ffmpeg/
While the sample doesn't deal with the operation you need, I suggest to adapt it to your needs.
ffmpeg-sharp is probably a good starting point.
Does someone knows how can I capture my computer screen to a video file? I need the file to be as small as possible. I'm using C#. Third party components also welcome.
TY
I think you are referring to creating a screen cast, if so this is the best I have used.
http://www.techsmith.com/camtasia.asp
It can produce many formats including FLV which can be configured to small file size.
You could take a look at ScapLib, and see if that suits your needs.
Directly capturing video from the desktop in .net does not seem to be a simple task. Here's an article from c-sharpcorner that might help you out: Link.