87732

How to convert RTP H.264 payload into playable file using Media Foundation

Question:

I need a way to be able to make a video file from H.264 RTPFrames (Payload Type 96) that I receive using the Managed Media Aggregation - <a href="https://net7mma.codeplex.com/" rel="nofollow">https://net7mma.codeplex.com/</a>.

I am trying to use media foundation in managed code.

I saw <a href="http://mfnet.sourceforge.net/" rel="nofollow">http://mfnet.sourceforge.net/</a> but I couldn't find how to do it. I saw that someone said in some forum that it is better to use the Media Foundation dlls in C# managed code.

Does anybody have any experience working with this?

<strong>EDIT:</strong>

I an trying to use the VLCDotNet to put the h264 frames into a video file - here is my code

private void StoreFile() { Vlc.DotNet.Core.VlcContext.LibVlcDllsPath = @"C:\Users\Ofek\Desktop\VideoLAN\VLC"; Vlc.DotNet.Core.VlcContext.Initialize(); media1 = new Vlc.DotNet.Core.Medias.LocationMedia("rtsp://192.168.30.11/1.mkv"); media1.AddOption(":sout=#transcode{vcodec=theo,vb=800, scale=1,acodec=flac,ab=128,channels=2,samplerate=44100}:std{access=file,mux=ogg, dst=D:\\123.mp4}"); VlcControl control = new VlcControl(); control.Media = media1; control.Play(); }

The Issue is that the file is created, but its not playable. I am looking for the command to save the H264 stream to a mp4 file <strong>without</strong> decoding it. any ideas?

Answer1:

Try playing the stream in the background as a process.

Process vlc; vlc = Process.Start("C://Program Files//Videolan//VLC//VLC.exe", "rtsp://192.168.30.11/1.mkv\" --qt-start-minimized --sout=#transcode{vcodec=theo,vb=800,acodec=flac,ab=128,channels=2,samplerate=44100}:file{dst=C://folder//filename.mp4,no-overwrite}"); Thread.Sleep(9000); vlc.kill();

Recommend

  • PhraseQuery Not working Lucene 4.5.0
  • Why would this NRE occur after a successful operation?
  • Unable to connect to FTP in Android
  • Save Bitmap to ICO file, with transparency
  • Pass class instance without reference
  • Set background color only for the first row in a DataGrid?
  • Java & Compile-Time Constants
  • Error with Firebase callable functions
  • How to format a decimal value WITHOUT rounding to store into nullable decimal Variable in c#
  • How to determine the target device programmatically in Android?
  • all android support libraries must use exact same version not working
  • Stream from Android device to shoutcast (upstreaming)
  • entering a cmd command with button click
  • How to save web audio streaming to file ( c++ / java )
  • Problems with downloading pdf file from web api service
  • iOS - Building VLC for iOS - Please install required SDK, or set SDKROOT manually
  • Change Worksheet When a Cell Value and a Checkbox Change
  • Use ENTER or RETURN as TAB in form and panels
  • Automaticly add CV-qualified functions
  • UITableView cell are overlapping
  • Run-time Error 424 Object Required UserForm doesnt exist
  • how to remove message “You are working with a preview version of the .NET Core SDK”
  • .NET Web API + Session Timeout
  • Invoking IISExpress using command line to host ASP.NET Core App
  • Store events from other programs
  • Open Video file in VLC through Python
  • Entity Framework Core 2.0 add-migration not generating anything
  • CakePHP ACL tutorial initDB function warnings
  • AES padding and writing the ciphertext to a disk file
  • Updating server-side rendering client-side
  • How to extract text from Word files using C#?
  • GridView Sorting works once only
  • SetUp method failed while running tests from teamcity
  • WPF Applying a trigger on binding failure
  • Understanding cpu registers
  • EntityFramework adding new object to nested object collection
  • Checking variable from a different class in C#
  • failed to connect to specific WiFi in android programmatically
  • How can I use threading to 'tick' a timer to be accessed by other threads?