How to convert RTP H.264 payload into playable fil

2019-09-06 21:00发布

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 - https://net7mma.codeplex.com/.

I am trying to use media foundation in managed code.

I saw http://mfnet.sourceforge.net/ 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?

EDIT:

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 without decoding it. any ideas?

1条回答
神经病院院长
2楼-- · 2019-09-06 21:51

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();
查看更多
登录 后发表回答