I'd need to get the video duration of a mp4 video (video format AVC)
I'm using DirectShowLib 2.1
I downloaded a couple of codecs but I'm still getting code -2147220891 (an error code that I don't know what it means) doing
graphBuilder.RenderFile(filePath, null);
Any idea how to get the duration of this kind of video?
-2147220891 is 0x80040265 in hex. A search for that error code revealed this thread
0x80040265 isn't really "unknown". Strictly, it is VFW_E_UNSUPPORTED_STREAM, which means that your AVI files contain at least one stream (e.g., the video) that you do not have the right codec for.
So it looks like you still haven't found the right codec.
Does the file play in Windows Media Player or VLC (for example)?
If you just need the duration of a file, you can try using IMediaDet. I have an example of usage here: http://wpfmediakit.codeplex.com/SourceControl/changeset/view/41623#245585
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
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
As far as I know one way of grabbning frames from video files in C# is using MediaDet. However MSDN says that Media Detector(MediaDet) is deprecated:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd390664(v=vs.85).aspx
What is the 'modern' way of getting frames from a video file using c#?
If you are looking for a thumbnail image from the video, take a look at FFMPEG.
there is a c# wrapper available . http://code.google.com/p/ffmpeg-sharp/
Checkout this link for a sample http://ramcrishna.blogspot.com/2008/09/playing-videos-like-youtube-and.html
I'm trying to write a Silverlight application that reads a media file from a database (most likely a .mpeg or .mpg) and play it on the fly using either a Silverlight MediaPlayer or ExpressionMediaPlayer. When I try using Expression Media Player it plays .wmv and .mp4 files but NOT .mpeg or .mpg file extensions. Is this even possible? If so, HOW?!
I tried going a different route originally where I wrote a Service to Encode the file using a LiveJob and then play it on the ExpressionMediaPlayer from the port using mms://localhost:8080 but I couldn't figure out how to use that to Play/Pause the video. It just ran through once and stopped. Any suggestions on that?
I'm using Expression Encoder 3 & Silverlight 4 by the way.
i think you're out of luck, check out this page from msdn.
You are going to have to re-encode the file if you want it to play in Silverlight.
A project I am currently working on at work requires the ability to convert videos from other formats to the WMV format. We need to be able to convert virtually any video format that is commonly used to a WMV format. I am looking for a solution allot like On2's flix engine converts other video types to .flv videos. I am aware of the encoder that windows offers, but it has a very limited list of video types that it can convert from. Please let me know if you have any suggestions or opinions, or recommendation of software I can use to do this. I need to be able to do the conversions in batch and I need to be able to do them programmatically with C#.
Have you had a look at ffmpeg?
It seems to be at the core of many open source video conversion utilities, so I imagine you could use it in the scenario you describe.
SUPER, the name is really covering the load!
Well, first you have to be able to decode the file format. You need to set this up with directshow, which is very hard to work with. You can take a look at the mediaportal project for a directshow file player written in C#. Instead of using the video renderer at the end of the directshow graph, you would reencode the video and audio and mux them into a .wmv file. This is a very involved project to get right. You essentially have to mimic a player's ability to play any format and handle failure.
I've been very satisfied using Quick Media Converter.