I'm working on an ASP.NET app that allows users to upload video files. After the user uploads, I need to determine some of the attributes of the media - namely it's duration/length, resolution, and codec (if possible).
What's the simplest way to approach this? Should I use the WMP SDK - this seems to involve actually instantiating the media player on the server. Is there anything in the framework to do this, or do I need to rely on an external library?
I'm not concerned about displaying or streaming the video back to the user.
There is nothing in the framework, you will need some sort of library. The best I've seen (but it has been a year or so since I've looked) is taglib-sharp:
http://developer.novell.com/wiki/index.php/TagLib_Sharp
The site seems to be down right now, but I see that it's been ported to fink (for OSX) only a couple of months ago, so I assume that is temporary.
oops, just saw that you're not the first to ask a question along these lines and I'm not the first to suggest taglib-sharp:
View/edit ID3 data for MP3 files
(note: it supports audio and video files).
hth
Related
I’m developing an UWP app that should be able to play videos transferred through a custom TCP protocol implementation.
Videos are MP4, so there’s no need to decode frames.
My current solution is to download the file first, and then allow the user to play it, but with big files this is quite annoying.
As a workaround I tried to implement IRandomAccessStream to feed the MediaPlayer while the file gets downloaded, but this isn’t a good solution for sure as there’s no buffering (and the video is just laggy on bad networks) nor visual download progress in the TransportControls.
I know it is possible to create a custom MediaStreamSource, but it requires known encoding properties to be created and anyway it sounds like an overkill to have to decode frames by myself to feed it.
So I’m wondering if there’s any solution to my problem.
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 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
I would like to emulate video input from a webcam for testing purposes.
So I need to be able to emulate a software video capture device in Windows and be able to dynamically generate its output.
How can I achieve this?
I would prefer a solution in C# or C++.
You can use a Virtual Webcam (old link, but there are others) it will take a video/images file and will display it in a webcam device. Your system will think that its a normal device.
Then you will need to create something that will generate the video/images, if you need static image then its pretty easy to generate a bmp.
Old (no selected answer) question.... actually probably one of the oldest I've ever seen... but I came across this looking for an answer myself, I remembered the day when "Virtual Webcam" still existed (now just a chinese ad site).
Fear not! There are new sources to solve your decade long quest:
First of all, checkout OBS, open source does a LOT with video streams:
https://obsproject.com/
Second, checkout this virtual webcam plugin for it. Does exactly what you're talking about, and does use #qbeuek's suggestion of DirectDraw:
https://obsproject.com/forum/resources/obs-virtualcam.949/
It is written in C++, so grabbing the bits you need and rewriting to C# is left as an exercise to the reader, but the capability is there.
As far as I know, there is a set of COM interfaces that govern the recording and playback of audio and video in Windows. It used to be called DirectShow, but maybe in the meantime the name has been changed. Those interfaces are used to construct a graph of audio and video filters, to encode / decode the data stream.
The way to go:
- read about the Microsoft DirectShow API,
- implement a COM object that implements the video source interface,
I'm looking at options for adding streaming video to a social web site written in ASP.NET/C#. I have a great deal of experience with Flash too, so I'm comfortable using FLV players, but I'd definitely go Silverlight if the right library is available.
The library would need to be able to encode user uploaded video in a web format.
I imagine playback will be Flash or Silverlight based.
It would need to create thumbnails of the video.
It would need to have server software for streaming the video or have some 3rd party way of doing so.
I don't mind paying a licensing fee for the software, so it does not have to be open source or free.
The license must allow use on a commercial web site.
The closest thing I have found is MediaSoft's offering. But I never heard of this company before starting my search and don't know anyone using their software. They seem to be using FFMPEG to perform encoding, which I heard can spawn legal issues for commercial web sites. Though I'm not very familiar with the licensing of FFMPEG myself so please correct me if I heard wrong.
Has anyone used MediaSoft? Any other video libraries that you have used that worked well? Did you just end up writing your own video encoding and serving library?
Not sure about Silverlight, but Flash will render both h.264 and FLV videos. FFMPEG can convert into both via liblame for FLV and x264 for h.264. It can also generate thumbnails.
It and the corresponding modules are licensed under the LGPL/GPL which means you can use FFMPEG to generate videos/thumbnails without restriction as long as you have the rights to the original movies that you're transcoding. The GPL/LGPL license restrictions only apply to the FFMPEG code/binaries which won't matter until you decide to distribute those binaries to other people.
In addition to the above answer, you can look at red5 as a streaming solution
http://osflash.org/red5