简体   繁体   English

在 SRS 中是否可以使用不是 libx264 的 FFMPEG 编码器进行转码?

[英]In SRS Is it possible to Transcode with an FFMPEG -encoder that is not libx264?

Is it possible to Transcode with an FFMPEG -encoder that is not libx264?是否可以使用非 libx264 的 FFMPEG 编码器进行转码? I have a few scenarios where I want to use NVEC hardware accelerated encoding.我有几个场景想使用 NVEC 硬件加速编码。 Also transcoding streams to AV1 is desirable too for the.network resiliency and lower bandwidth.对于网络弹性和较低带宽,也需要将流转码为 AV1。 Currently when I try to use another encoder than libx264 I get an error that says I must use Libx264.目前,当我尝试使用 libx264 以外的其他编码器时,我收到一条错误消息,提示我必须使用 Libx264。 Is there a way around this?有没有解决的办法?

SRS wrap the FFmpeg CLI and has a set of limitation about the params, for example, you could only use h.264 not h.265/av1 for video codec, because it simplify the usage of FFmpeg. SRS 封装了 FFmpeg CLI 并且有一组关于参数的限制,例如,您只能使用 h.264 而不能使用 h.265/av1 作为视频编解码器,因为它简化了 FFmpeg 的使用。

For example, the ingester/transcode config is bellow:例如,ingester/transcode 配置如下:

    ingest livestream {
        enabled      on;
        input {
            type    file;
            url     ./doc/source.200kbps.768x320.flv;
        }
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
        engine {
            enabled          off;
            output          rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
        }
    }

It equals to the FFmpeg CLI as demonstrated bellow:它等于 FFmpeg CLI,如下所示:

./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv \
  -c copy -f flv rtmp://127.0.0.1/live/livestream

You could find out the CLI in SRS log:您可以在 SRS 日志中找到 CLI:

fored process, pid=76501, bin=./objs/ffmpeg/bin/ffmpeg, 
argv=./objs/ffmpeg/bin/ffmpeg -loglevel info -re -i 
./doc/source.200kbps.768x320.flv -vcodec copy -acodec copy -f flv 
-y rtmp://127.0.0.1:1935/live?vhost=__defaultVhost__/livestream

Rather than use the SRS ingest/transcode feature, you could run your FFmpeg CLI with any params you want, please read FFmpeg .您可以使用您想要的任何参数运行 FFmpeg CLI,而不是使用 SRS 摄取/转码功能,请阅读FFmpeg It works like this:它是这样工作的:

OBS --RTMP--> SRS --hooks--> Your Backend Server
                                  +
                                  +--fork--> FFmpeg

Once you start a ffmpeg process, you could use libx265 or av1, to pull stream from SRS and transcode it, then publish it to SRS again.启动 ffmpeg 进程后,您可以使用 libx265 或 av1 从 SRS 中提取 stream 并对其进行转码,然后再次将其发布到 SRS。

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

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