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?
Asked
Active
Viewed 271 times
1 Answers
0
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.

Winlin
- 1,136
- 6
- 25