简体   繁体   English

使用 ffmpeg 将直播从 m3u8 录制到管道会导致视频没有音频

[英]Recording livestream from m3u8 to pipe using ffmpeg results in video with no audio

I'm not very good with ffmpeg, so this code is something I've created through trial and error.我对 ffmpeg 不是很好,所以这段代码是我通过反复试验创建的。 I'm using ffmpeg from VB.net with the arguments:我正在使用来自 VB.net 的 ffmpeg 和参数:

Dim CL As String = "-y -i " & Chr(34) & URL & Chr(34) & " -t " & Time & " -acodec copy -vcodec copy -f mpeg pipe:pipe1"

The videos end up having no audio.视频最终没有音频。 I tried removing '-acodec copy' and '-vcodec copy' and using '-map 0', which creates a video with audio, but the quality is substantially lower.我尝试删除“-acodec copy”和“-vcodec copy”并使用“-map 0”,这会创建带有音频的视频,但质量要低得多。 I'd like to retain the quality and still have audio.我想保持质量并仍然有音频。

After trawling the documentation, I found that there's a format called mpegts (which appears to be the one of the files m3u8 contains), so I tried changing the code to在浏览文档后,我发现有一种名为 mpegts 的格式(它似乎是 m3u8 包含的文件之一),所以我尝试将代码更改为

Dim CL As String = "-y -i " & Chr(34) & URL & Chr(34) & " -t " & Time & " -acodec copy -vcodec copy -f mpegts pipe:pipe1"

And it's retaining the quality and has audio.它保持质量并具有音频。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM