简体   繁体   中英

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? I have a few scenarios where I want to use NVEC hardware accelerated encoding. Also transcoding streams to AV1 is desirable too for the.network resiliency and lower bandwidth. Currently when I try to use another encoder than libx264 I get an error that says I must use 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.

For example, the ingester/transcode config is bellow:

    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:

./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:

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 . 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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