저는 ffmpeg를 사용하여 16개의 라이브 wowza 스트림에서 모자이크를 만들려고 합니다. ffmpeg에서 nvenc 지원을 활성화하고 라이브 스트리밍 모자이크를 만들었습니다. 다만, 영상 재생 중 끊김 현상이 일부 발생합니다. 비디오가 동기화되어 재생되지 않습니다. 이것은 내 스크립트입니다.
#!/bin/bash
/home/sysadmin/Downloads/ffmpeg-3.2.4/ffmpeg
-i rtsp://10.10.0.46:1935/live/stream1.stream
-i rtsp://10.10.0.46:1935/live/stream2.stream
-i rtsp://10.10.0.46:1935/live/stream3.stream
-i rtsp://10.10.0.46:1935/live/stream4.stream
-i rtsp://10.10.0.46:1935/live/stream5.stream
-i rtsp://10.10.0.46:1935/live/stream6.stream
-i rtsp://10.10.0.46:1935/live/stream7.stream
-i rtsp://10.10.0.46:1935/live/stream8.stream
-i rtsp://10.10.0.46:1935/live/stream9.stream
-i rtsp://10.10.0.46:1935/live/stream10.stream
-i rtsp://10.10.0.46:1935/live/stream11.stream
-i rtsp://10.10.0.46:1935/live/stream12.stream
-i rtsp://10.10.0.46:1935/live/stream13.stream
-i rtsp://10.10.0.46:1935/live/stream14.stream
-i rtsp://10.10.0.46:1935/live/stream15.stream
-i rtsp://10.10.0.46:1935/live/stream16.stream
-filter_complex "nullsrc=size=1280x720 [base];[0:v] setpts=PTS-STARTPTS, scale=320x180 [vid1]; [1:v] setpts=PTS-STARTPTS, scale=320x180 [vid2];[2:v] setpts=PTS-STARTPTS, scale=320x180 [vid3]; [3:v] setpts=PTS-STARTPTS, scale=320x180 [vid4]; [4:v] setpts=PTS-STARTPTS, scale=320x180 [vid5]; [5:v] setpts=PTS-STARTPTS, scale=320x180 [vid6]; [6:v] setpts=PTS-STARTPTS, scale=320x180 [vid7];[7:v] setpts=PTS-STARTPTS, scale=320x180 [vid8]; [8:v] setpts=PTS-STARTPTS, scale=320x180 [vid9]; [9:v] setpts=PTS-STARTPTS, scale=320x180 [vid10]; [10:v] setpts=PTS-STARTPTS, scale=320x180 [vid11]; [11:v] setpts=PTS-STARTPTS, scale=320x180 [vid12]; [12:v] setpts=PTS-STARTPTS, scale=320x180 [vid13]; [13:v] setpts=PTS-STARTPTS, scale=320x180 [vid14]; [14:v] setpts=PTS-STARTPTS, scale=320x180 [vid15]; [15:v] setpts=PTS-STARTPTS, scale=320x180 [vid16]; [base][vid1] overlay=shortest=1 [tmp1]; [tmp1][vid2] overlay=shortest=1:x=320 [tmp2]; [tmp2][vid3] overlay=shortest=1:x=640 [tmp3]; [tmp3][vid4] overlay=shortest=1:x=960 [tmp4]; [tmp4][vid5] overlay=shortest=1:y=180 [tmp5]; [tmp5][vid6] overlay=shortest=1:x=320:y=180 [tmp6]; [tmp6][vid7] overlay=shortest=1:x=640:y=180 [tmp7]; [tmp7][vid8] overlay=shortest=1:x=960:y=180 [tmp8]; [tmp8][vid9] overlay=shortest=1:y=360 [tmp9]; [tmp9][vid10] overlay=shortest=1:x=320:y=360 [tmp10]; [tmp10][vid11] overlay=shortest=1:x=640:y=360 [tmp11]; [tmp11][vid12] overlay=shortest=1:x=960:y=360 [tmp12]; [tmp12][vid13] overlay=shortest=1:y=540 [tmp13]; [tmp13][vid14] overlay=shortest=1:x=320:y=540 [tmp14]; [tmp14][vid15] overlay=shortest=1:x=640:y=540 [tmp15]; [tmp15][vid16] overlay=shortest=1:x=960:y=540" -strict experimental -c:v h264_nvenc -f mpegts udp://225.50.50.111:9001?pkt_size=1316
답변1
나는 이것을 사용했습니다 :
ffmpeg -i 1.ts -i 2.ts -i 3.ts -i 4.ts -i 5.ts -i 6.ts -i 7.ts -i 8.ts -i 9.ts -i 10.aac -filter_complex "[9:a][10:a] amix=inputs=2; nullsrc=size=1280x720 [base]; [0:v]setpts=PTS-STARTPTS, scale=426x240 [vid1]; [1:v]setpts=PTS-STARTPTS, scale=426x240 [vid2];[2:v] setpts=PTS-STARTPTS, scale=426x240 [vid3]; [3:v] setpts=PTS-STARTPTS, scale=426x240 [vid4]; [4:v] setpts=PTS-STARTPTS, scale=426x240 [vid5]; [5:v] setpts=PTS-STARTPTS, scale=426x240 [vid6]; [6:v] setpts=PTS-STARTPTS, scale=426x240 [vid7];[7:v] setpts=PTS-STARTPTS, scale=426x240 [vid8]; [8:v] setpts=PTS-STARTPTS, scale=426x240 [vid9]; [base][vid1] overlay=shortest=0 [tmp1]; [tmp1][vid2] overlay=shortest=0:x=426 [tmp2]; [tmp2][vid3] overlay=shortest=0:x=852 [tmp3]; [tmp3][vid4] overlay=shortest=0:y=240 [tmp4]; [tmp4][vid5] overlay=shortest=0:x=426:y=240 [tmp5]; [tmp5][vid6] overlay=shortest=0:x=852:y=240 [tmp6]; [tmp6][vid7] overlay=shortest=0:y=480 [tmp7]; [tmp7][vid8] overlay=shortest=0:x=426:y=480 [tmp8]; [tmp8][vid9] overlay=shortest=0:x=852:y=480" -strict experimental -c:v h264 -preset:v ultrafast -maxrate 2000k -minrate 2000k -bufsize 1200k -f segment -segment_format mpegts -segment_time 10 -segment_list_size 6 -segment_format_options mpegts_flags=+initial_discontinuity:mpegts_copyts=1 -segment_list_type m3u8 -segment_list_flags +live+delete -segment_list xxxx.m3u8 xxx1.ts
답변2
가장 짧게 시도=0
가장 짧은 스트림을 멈추지 않습니다.
그리고 짐을 확인해보세요!
다정하게