我用 nginx
和 ffmpeg
从我的提供商重新流式传输视频。以前我在重新编码视频和重新编码音频时使用带有参数的 ffmpeg,因为我的服务器速度很慢,我退出了重新编码。
所以现在,我使用该命令:
ffmpeg -re -i http://link.somelink.com:6565/21d12d1/17233 -map 0 -c copy -bsf:a aac_adtstoasc -f flv -flvflags no_duration_filesize rtmp://test_ip/canal/stream
这仅在我的提供商使用
aac
进行流式传输时才有效。音频编解码器,但有时我的提供商将音频编解码器更改为 ac3
.然后这不起作用。我尝试这样的事情:ffmpeg -thread_queue_size 32768 -re -i http://link.somelink.com:6565/21d12d1/17233 -c:v copy -c:a aac -f flv -flvflags no_duration_filesize rtmp://test_ip/canal/stream
使用 ffmpeg 在控制台中看起来一切正常,但我的重新流式传输视频不起作用。 Ngnix 有时会抛出 304 异常。
有什么建议么?
请帮忙,
对我来说非常重要...
最佳答案
Ac3 不在支持的编解码器列表中。您应该相应地编码您的流。
RTMP supports only a limited number of codecs. The most popular RTMP video codecs are H264, Sorenson-H263 (aka flv) and audio codecs AAC, MP3, Nellymoser, Speex. If your video is encoded with these codecs (the most common pair is H264/AAC) then you do not need any conversion. Otherwise you need to convert video to one of supported codecs.
https://github.com/arut/nginx-rtmp-module/wiki/Getting-started-with-nginx-rtmp
关于nginx - ffmpeg 和 nginx - 使用音频重新编码重新流式传输,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60965347/