【发布时间】:2020-08-13 01:50:23
【问题描述】:
我每晚都在使用 VLC 包装器 VLC.DotNet、libvlc 3.0.3 或 3.0.4,并尝试示例:
static void Main(string[] args)
{
var currentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
// Default installation path of VideoLAN.LibVLC.Windows
var libDirectory =
new DirectoryInfo(Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));
var destination = Path.Combine(currentDirectory, "record.mp4");
using (var mediaPlayer = new Vlc.DotNet.Core.VlcMediaPlayer(libDirectory))
{
var mediaOptions = new[]
{
":sout=file{dst=" + destination + "}",
":sout-keep"
};
mediaPlayer.SetMedia(new Uri("rtsp://192.168.x.xxx/ch1.h264"),
mediaOptions);
mediaPlayer.Play();
Console.WriteLine($"Recording in {destination}");
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
一切都很好,我在文件夹中看到录制的文件,但是当我更改媒体选项格式时,文件没有录制... F.E:
var mediaOptions = new[]
{
":sout=#transcode{vcodec=h264}:std{access=file,mux=ffmpeg{mux=flv}),file{dst=" + destination + "}",
":sout-keep"
};
我需要将来自摄像机的流式视频编码为带有 mp3 或 AAC 音频的 H.264 mp4 视频文件。 如果有人帮我做这个例子,那就太好了。
【问题讨论】:
标签: video vlc video-encoding libvlc