I am trying to decompress an AVI file using DirectShow filters.
Here is the graph I am building.
File Reader -> AVI Splitter -> AVI decompressor -> SampleGrabber ->AVI Mux -> File Writer
I am suing SampleGrabber to report progress of conversion, nothing else.
The issue that I am having is that once the file is converted there is no audio in it. Video is all ok, but there is no Audio. I have tried the same set of filters using GraphEdt and it converts ok (Both Audio and Video are intact).
I really don't know what might be going wrong in this whole process. Any ideas?
I am using DirectShowNet
Related
I am using Tao framework and I have a simple opengl control.
How can I record a video from this control and save it to a file?
See here for a link that mentions both Bitmap screen capture in C# and starts to describe the AVI conversion.
For further information about the library used to in the first link to make an avi file from a collection of bitmap images see here.
See here for an example that uses the Media Player Encoder in order record the screen.
The more complicated and direct way would be to either use a video capture card or write a software device that emulates one and feed that source to DirectShow filter using DirectShow.Net or Pinvoking other DirectShow libaries directly.
How can I record a video from this control and save it to a file?
Use glReadPixels to get the pixel data. Feed the pixel data into a video encoder (e.g. a DirectShow filter graph, or through ffmpeg/libavcodec or sump the images into files and encode them to video later).
I want to record video and audio files using C#. After recording of audio + video i want to merge them. There can be only one video file and 10 audio file. I want this ten files to overlay on one video file.
I am assure that i want video file in .wmv format. Can you tell me i should record audios in which format so later i can overlay those audio files on .wmv format video file?
Also please let me know how to overlay audio file on .wmv video file?
Hope i will get prompt reply for this
You can use DirectShow Editing Services (DES) to do it. DirectShowLib should provide DES support in C#. Using it, create a timeline with video group (1 track) and audio group (several tracks if you need to overlay/mix some audios, i.e. hear more than one at a time). Place your video and audio files on the timeline in desired positions. Then tell DES to create a DirectShow graph and you'll get one video and one audio output pin. Connect them to ASF writer to save result to WMV.
I'm using flow player for streaming videos to my browser.The videos are uploaded by the users and they may upload different formats. What will be solution to stream the videos as mp4 , what ever be the format they upload. I'm currently using ffmpeg commands.
The problem is after encoding the video is getting down scaled.Also if the user upload large video file the encoding itself takes more time.
I need to stream the videos as soon as its uploaded to the server, what ever may be the format(like in youtube).
I'd look into ffmpeg as it allows yo to transcode just about every video format on the planet.
However; I'm not sure of it's real-time capabilities or it's abilities to stream it's output. Might be a good place to start though.
I think you could do this by automating expression encoder on the server even though it is mainly used for smooth streaming format but expression encoder isn't opensource or free :(
how to convert avi file to an jpg's images array using .net , i need to develop a task that will take the avi file and save it as jpg images on another folder
You can do this from the command line with ffmpeg. See this part of the documentation. For example,
ffmpeg -i infile.avi -f image2 image-%03d.jpg
will save all frames from infile.avi as numbered jpegs (image-001.jpg, image-002.jpg,...). You can then use other command line options to get just the frames you want or do some other post processing like resizing or deinterlacing.
You could just create a program in .NET that calls the ffmpeg executable with the right command line and moves the resulting files into the correct place. It would be much easier than trying to use some video library directly.
have a look at: http://ffmpegdotnet.codeplex.com/
Looking a bit further, it appears there is no download there, but found this too:
http://www.intuitive.sk/fflib/post/fflib-net-released.aspx
.NET has no out-of-the-box way of managing audio or video. You'd have to use an external API.
DirectX for example can handle .avi files.
I am developing an application in which I need to extract the audio from a video. The audio needs to be extracted in .wav format but I do not have a problem with the video format. Any format will do, as long as I can extract the audio in a wav file.
Currently I am using Windows Media Player COM control in a windows form to play the videos, but any other embedded player will do as well.
Any suggestions on how to do this?
Thanks
If you want to do this with C#, take a look at NAudio library. It can analyze the audio format (like FFMpeg) and also provide the audio stream. Here's one example.
Snippet from the sample:
using NAudio.Wave;
using System.IO;
...
// contentAsByteArray consists of video bytes
MemoryStream contentAsMemoryStream = new MemoryStream(contentAsByteArray);
using (WaveStream pcmStream =
WaveFormatConversionStream.CreatePcmStream(
new StreamMediaFoundationReader(contentAsMemoryStream)))
{
WaveStream blockAlignReductionStream = new BlockAlignReductionStream(pcmStream);
// Do something with the wave stream
}
Here is a link on how to extract audio using GraphEdit, GraphEdit is an front end UI for the DirectShow API so everything it can do you can do with API.
You can use the DirectShow.NET liberty which wraps the DirectShow API for the managed world.
Probably easiest to use ffmpeg for this kinda thing...
Very easy with FFMPEG! I routinely do this to grab audio out of downloaded youtube videos, convert music downlaods to WAV for editing, etc etc. It should work for any file extension:
ffmpeg -i source-of-any-file-extension.avi -vn -ar 44100 -ac 2 -ab 768000 -f wav target-filename.wav