openvidu-test-e2e: fix RTSP publication of MJPEG/MPEG-4 codecs with newer bluenviron/mediamtx ffmpeg container

pull/875/merge
pabloFuente 2026-07-12 00:01:47 +02:00
parent 24151bca0b
commit 9f68247dc5
1 changed files with 9 additions and 3 deletions

View File

@ -296,7 +296,12 @@ public class OpenViduTestE2e {
String codecs = getCodecs(videoCodec, audioCodec);
String rtspServerIp = "host.docker.internal";
String ffmpegCommand = "ffmpeg -i " + fileUrl + " " + codecs + " "
// -re paces the publisher at native frame rate, like the live camera it
// simulates. Without it, cheap codecs (MJPEG, MPEG-4) encode the whole file
// many times faster than realtime on fast runners: mediamtx discards most
// frames and, when ffmpeg finishes early and exits, terminates the reader
// session, killing the ingress mid-test.
String ffmpegCommand = "ffmpeg -re -i " + fileUrl + " " + codecs + " "
+ " -async 50 -strict -2 -f rtsp -rtsp_transport tcp rtsp://" + rtspServerIp + ":" + rtspPort + "/"
+ RTSP_PATH;
@ -337,8 +342,9 @@ public class OpenViduTestE2e {
String fileUrl = getFileUrl(videoCodec != null, audioCodec != null, true);
String codecs = getCodecs(videoCodec, audioCodec);
String ffmpegCommand = "ffmpeg -i " + fileUrl + " " + codecs + " -strict -2 -f mpegts srt://:" + RTSP_SRT_PORT
+ "?mode=listener";
// -re: see startRtspServer.
String ffmpegCommand = "ffmpeg -re -i " + fileUrl + " " + codecs + " -strict -2 -f mpegts srt://:"
+ RTSP_SRT_PORT + "?mode=listener";
// Clean adjacent white spaces or the ffmpeg command will fail
ffmpegCommand = ffmpegCommand.trim().replaceAll(" +", " ");