i was doing tests in different ways, and i can't use the Exec or Transcode option, i highlight that I have copied the ffmpeg.exe in the objs folder. These are the codes I tried, and I attach the log errors.
exec {
enabled on;
publish ./objs/ffmpeg.exe -rtbufsize 10M -i rtmp://10.1.9.240/live/encoder -vf scale=1080:720 -c:v libx264 -profile:v high -level 4.2 -preset fast -b:v 1500k -c:a aac -ac 2 -b:a 96k -f flv -y rtmp://10.1.9.240:1935/live/encoderlow/;
}
LOGS
[2023-01-04 10:05:46.410][WARN][1309][01568ctu][11] EXEC: Ignore error, code=3028(FFmpegFork)(Failed to fork FFmpeg trancoder process) : process start : vfork process failed, cli=./objs/ffmpeg.exe -rtbufsize 10M -i rtmp://10.1.9.240/live/encoder -vf scale=1080:720 -c:v libx264 -profile:v high -level 4.2 -preset fast -b:v 1500k -c:a aac -ac 2 -b:a 96k -f flv -y rtmp://10.1.9.240:1935/live/encoderlow/ thread [1309][01568ctu]: do_cycle() [./src/app/srs_app_ng_exec.cpp:108][errno=11] thread [1309][01568ctu]: start() [./src/app/srs_app_process.cpp:197][errno=11]
transcode {
enabled on;
ffmpeg ./objs/ffmpeg.exe;
engine ff {
enabled on;
vfilter {
}
vcodec libx264;
vthreads 4;
vprofile high;
vpreset fast;
vbitrate 1500k;
vparams {
}
acodec libfdk_aac;
aparams {
}
output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
}
}
LOGS
[2023-01-04 11:04:45.295][WARN][1489][34r32764][11] Encoder: Ignore error, code=3028(FFmpegFork)(Failed to fork FFmpeg trancoder process) : ffmpeg start : vfork process failed, cli=./objs/ffmpeg.exe -f flv -i rtmp://127.0.0.1:1935/live?vhost=defaultVhost/encoder -vcodec libx264 -b:v 1500000 -threads 4 -profile:v high -preset fast -acodec libfdk_aac -f flv -y rtmp://127.0.0.1:1935/live/encoder_ff?vhost=defaultVhost 1 > ./objs/ffmpeg-encoder-defaultVhost-live-encoder-ff.log 2 > ./objs/ffmpeg-encoder-defaultVhost-live-encoder-ff.log thread [1489][34r32764]: do_cycle() [./src/app/srs_app_encoder.cpp:117][errno=11] thread [1489][34r32764]: start() [./src/app/srs_app_process.cpp:197][errno=11]
SRS windows use cygwin64, which is not support fork
ffmpeg.exe
process on win32, so it does not work for neither exec or transcode.So you can try win64, which should work well with
ffmpeg.exe
.However, there is a workaround, to start a
ffmpeg.exe
process to do transcode manually, for example:Because SRS will do this for you, but it's not a good idea to let SRS to do this. Instead, you should use HTTP callback to hook the on_publish event, then start a FFmpeg process. Like this:
The reason is quiet straight forward: To start and manage FFmpeg processes, we should use Go/Nodejs/Python backend server, but not C/C++ server like SRS or Nginx.