#video #ffmpeg #streaming #vlc #live
#Видео #ffmpeg #потоковое вещание #vlc #ЖИВЫЕ КОНЦЕРТЫ
Вопрос:
Я пытался создать канал multiview для прямой трансляции, используя xvfb, firefox, vlc, ffmpeg и shaka packager. 1). Для создания виртуального дисплея использовался Xvfb. 2). При появлении веб-страницы использовался fireforx на 1). 3). Для рисования девяти видео (каждого канала) использовался плагин vlc на 2). 4). Захват 2) использовал библиотеку ffmpeg, x11grab. 5). Транскодирование 4) в FHD (HEVC) 10 аудио (звук каждого канала фиктивный), FHD (H.264) без звука, HD (H.264) без звука, SD (H.264) без звука, nHD (H.264) без звука 6). упаковка 5) использованный упаковщик Shaka
Это моя команда. сценарий оболочки
function exec-xvfb () {
$XVFB :$display_port -br -noreset -nolisten tcp -screen 0 1920x1080x24 amp;}
function exec-firefox () {
AUDIO_CTRL_PATH="$audio_ctrl_port:/TEST/vlcenv/.sync.dat" VLC_INFO_PATH=/TEST/vlcenv/vlc_info.dat AUDIO_SHARE_KEY="$AUDIO_SHARE_KEY" AUDIO_SHARE_PATH=/TEST/vlcenv/.share.shm MOSAIC_META_PATH=/TEST/meta_bin.dat DISPLAY=":$display_port" $FIREFOX --display=:$display_port --no remote --profile /TEST/browser -width 1920 -height 1080 http://127.0.0.1:8021/template/best_channel_9_1/page/index.html amp;
}
function transcoder () {
AUDIO_CTRL_PATH="$audio_ctrl_port:/TEST/vlcenv/.sync.dat" VLC_INFO_PATH=/TEST/vlcenv/vlc_info.dat
AUDIO_SHARE_KEY="$AUDIO_SHARE_KEY" AUDIO_SHARE_PATH=/TEST/vlcenv/.share.shm
MOSAIC_META_PATH=/TEST/meta_bin.dat DISPLAY=":$display_port"
LD_LIBRARY_PATH=/transcoder/lib:/transcoder/lib/cuda /transcoder/gpu/transcoder -y -re
-analyzeduration 0 -f s16le -ar 48000 -ac 2 -pkt_size 128000 -i syc://@:$trc_sync_port?dummy=1
-analyzeduration 0 -f s16le -ar 48000 -ac 2 -pkt_size 128000 -i syc://@:$(($trc_sync_port 1))
-analyzeduration 0 -f s16le -ar 48000 -ac 2 -pkt_size 128000 -i syc://@:$(($trc_sync_port 2))
-analyzeduration 0 -f s16le -ar 48000 -ac 2 -pkt_size 128000 -i syc://@:$(($trc_sync_port 3))
-analyzeduration 0 -f s16le -ar 48000 -ac 2 -pkt_size 128000 -i syc://@:$(($trc_sync_port 4))
-analyzeduration 0 -f s16le -ar 48000 -ac 2 -pkt_size 128000 -i syc://@:$(($trc_sync_port 5))
-analyzeduration 0 -f s16le -ar 48000 -ac 2 -pkt_size 128000 -i syc://@:$(($trc_sync_port 6))
-analyzeduration 0 -f s16le -ar 48000 -ac 2 -pkt_size 128000 -i syc://@:$(($trc_sync_port 7))
-analyzeduration 0 -f s16le -ar 48000 -ac 2 -pkt_size 128000 -i syc://@:$(($trc_sync_port 8))
-analyzeduration 0 -f s16le -ar 48000 -ac 2 -pkt_size 128000 -i syc://@:$(($trc_sync_port 9))
-analyzeduration 0 -f x11grab -draw_mouse 0 -video_size 1920x1080 -framerate 29.97 -i :$display_port.0 0,0,nomouse
-c:a libfdk_aac -ar:a 48000 -ac:a 2 -b:a 128000 -vf hwupload_cuda=device=$gpu_no,scale_npp=1920:1080:format=yuv420p -gpu $gpu_no -c:v hevc_nvenc -preset:v fast -profile:v main -r 29.97 -g 15 -b:v 6000000 -bufsize 14000000 -maxrate 7000000
-map 0:a -map 1:a -map 2:a -map 3:a -map 4:a -map 5:a -map 6:a -map 7:a -map 8:a -map 9:a -map 10:v -f mpegts udp://127.0.0.1:$trc_output_port?pkt_size=1316
-an -vf hwupload_cuda=device=$gpu_no,scale_npp=1920:1080:format=yuv420p -gpu $gpu_no -c:v h264_nvenc -preset:v fast -profile:v main -r 29.97 -g 15 -b:v 4000000 -bufsize 8000000 -maxrate 4000000 -f mpegts udp://127.0.0.1:$(($trc_output_port 1))?pkt_size=1316
-an -vf hwupload_cuda=device=$gpu_no,scale_npp=1280:720:format=yuv420p -gpu $gpu_no -c:v h264_nvenc -preset:v fast -profile:v main -r 29.97 -g 15 -b:v 2000000 -bufsize 4000000 -maxrate 2000000 -f mpegts udp://127.0.0.1:$(($trc_output_port 2))?pkt_size=1316
-an -vf hwupload_cuda=device=$gpu_no,scale_npp=720:480:format=yuv420p -gpu $gpu_no -c:v h264_nvenc -preset:v fast -profile:v main -r 29.97 -g 15 -b:v 1500000 -bufsize 3000000 -maxrate 1500000 -f mpegts udp://127.0.0.1:$(($trc_output_port 3))?pkt_size=1316
-an -vf hwupload_cuda=device=$gpu_no,scale_npp=640:360:format=yuv420p -gpu $gpu_no -c:v h264_nvenc -preset:v fast -profile:v main -r 29.97 -g 15 -b:v 800000 -bufsize 1600000 -maxrate 800000 -f mpegts udp://127.0.0.1:$(($trc_output_port 4))?pkt_size=1316 main amp;
}
function packager () {
rm -rf $OUTPUT/*
/packager/packager
"in=udp://127.0.0.1:$trc_output_port,stream=0,init_segment=$OUTPUT/audio/0/audio_4.mp4,segment_template=$OUTPUT/audio/0/$Time$.m4s" "in=udp://127.0.0.1:$trc_output_port,stream=1,init_segment=$OUTPUT/audio/1/audio_4.mp4,segment_template=$OUTPUT/audio/1/$Time$.m4s"
"in=udp://127.0.0.1:$trc_output_port,stream=2,init_segment=$OUTPUT/audio/2/audio_4.mp4,segment_template=$OUTPUT/audio/2/$Time$.m4s"
"in=udp://127.0.0.1:$trc_output_port,stream=3,init_segment=$OUTPUT/audio/3/audio_4.mp4,segment_template=$OUTPUT/audio/3/$Time$.m4s"
"in=udp://127.0.0.1:$trc_output_port,stream=4,init_segment=$OUTPUT/audio/4/audio_4.mp4,segment_template=$OUTPUT/audio/4/$Time$.m4s"
"in=udp://127.0.0.1:$trc_output_port,stream=5,init_segment=$OUTPUT/audio/5/audio_4.mp4,segment_template=$OUTPUT/audio/5/$Time$.m4s"
"in=udp://127.0.0.1:$trc_output_port,stream=6,init_segment=$OUTPUT/audio/6/audio_4.mp4,segment_template=$OUTPUT/audio/6/$Time$.m4s"
"in=udp://127.0.0.1:$trc_output_port,stream=7,init_segment=$OUTPUT/audio/7/audio_4.mp4,segment_template=$OUTPUT/audio/7/$Time$.m4s"
"in=udp://127.0.0.1:$trc_output_port,stream=8,init_segment=$OUTPUT/audio/8/audio_4.mp4,segment_template=$OUTPUT/audio/8/$Time$.m4s"
"in=udp://127.0.0.1:$trc_output_port,stream=9,init_segment=$OUTPUT/audio/9/audio_4.mp4,segment_template=$OUTPUT/audio/9/$Time$.m4s"
"in=udp://127.0.0.1:$trc_output_port,stream=video,init_segment=$OUTPUT/video/0/video_4.mp4,segment_template=$OUTPUT/video/0/$Time$.m4s"
"in=udp://127.0.0.1:$(($trc_output_port 1)),stream=video,init_segment=$OUTPUT/video/1/video_4.mp4,segment_template=$OUTPUT/video/1/$Time$.m4s"
"in=udp://127.0.0.1:$(($trc_output_port 2)),stream=video,init_segment=$OUTPUT/video/2/video_4.mp4,segment_template=$OUTPUT/video/2/$Time$.m4s"
"in=udp://127.0.0.1:$(($trc_output_port 3)),stream=video,init_segment=$OUTPUT/video/3/video_4.mp4,segment_template=$OUTPUT/video/3/$Time$.m4s"
"in=udp://127.0.0.1:$(($trc_output_port 4)),stream=video,init_segment=$OUTPUT/video/4/video_4.mp4,segment_template=$OUTPUT/video/4/$Time$.m4s"
--segment_duration 10 --fragment_duration 10 --minimum_update_period 10 --allow_codec_switching --preserved_segments_outside_live_window 24 --time_shift_buffer_depth 40
--mpd_output $OUTPUT/$output_mpd.mpd
}
предупреждения vlc и сообщения об ошибках при длительности 7
...
adaptive debug: Timeline
adaptive debug: Element #1 d=669670 r=0 @t=6321195
adaptive debug: Element #2 d=576576 r=0 @t=6990865
adaptive debug: Element #3 d=669670 r=0 @t=7567441
adaptive debug: Element #4 d=672673 r=0 @t=8237111
adaptive debug: Element #5 d=561561 r=0 @t=8909784
adaptive debug: Element #6 d=654655 r=0 @t=9471345
adaptive debug: Element #7 d=630631 r=0 @t=10126000
adaptive debug: Updated MPD, next update in 7s
main warning: picture is too late to be displayed (missing 223 ms)
main warning: picture is too late to be displayed (missing 157 ms)
main warning: picture is too late to be displayed (missing 91 ms)
main warning: picture is too late to be displayed (missing 24 ms)
adaptive debug: Retrieving http://192.168.0.181:81/300/audio/5/9451440.m4s @0
adaptive debug: Retrieving http://192.168.0.181:81/300/video/0/9475185.m4s @0
adaptive debug: Retrieving http://192.168.0.181:81/300/300.mpd @0
main debug: creating access: http://192.168.0.181:81/300/300.mpd
main debug: (path: \192.168.0.181:81300300.mpd)
main debug: looking for access module matching "http": 26 candidates
http debug: resolving 192.168.0.181 ...
http debug: outgoing request: GET /300/300.mpd HTTP/1.1 Host:192.168.0.181:81 Accept: */* Accept-Language: en_US User-Agent: VLC/3.0.11 LibVLC/3.0.11 Range: bytes=0-
http debug: incoming response: HTTP/1.1 206 Partial Content Server: nginx Date: Mon, 17 Aug 2020 09:10:08 GMT Content-Type: application/octet-stream Content-Length: 10406 Last-Modified: Mon, 17 Aug 2020 09:10:08 GMT Connection: keep-alive ETag: "5f3a4970-28a6" Content-Range: bytes 0-10405/10406
main debug: using access module "access"
main debug: looking for stream_filter module matching "prefetch,cache_block": 24 candidates
prefetch debug: using 10406 bytes buffer, 10406 bytes read
main debug: using stream_filter module "prefetch"
main debug: looking for stream_filter module matching "any": 24 candidates
main debug: no stream_filter modules matched
main debug: looking for stream_filter module matching "inflate": 24 candidates
main debug: no stream_filter modules matched
prefetch debug: end of stream
main debug: removing module "prefetch"
main debug: removing module "access"
main debug: looking for xml reader module matching "any": 1 candidates
main debug: using xml reader module "xml"
adaptive debug: MPD profile=urn:mpeg:dash:profile:isoff-live:2011 mediaPresentationDuration=0 minBufferTime=2
adaptive debug: BaseUrl=http://192.168.0.181:81/300/
adaptive debug: Period
adaptive debug: BaseAdaptationSet 0
adaptive debug: Representation 0 [mp4a]
adaptive debug: InitSegmentTemplate #0 url=http://192.168.0.181:81/300/audio/0/audio_4.mp4 duration 0
adaptive debug: SegmentTemplate #12 url=http://192.168.0.181:81/300/audio/0/$Time$.m4s duration 0
adaptive debug: Timeline
adaptive debug: Element #1 d=629760 r=1 @t=6930480
adaptive debug: Element #3 d=631680 r=0 @t=8190000
adaptive debug: Element #4 d=629760 r=3 @t=8821680
adaptive debug: Representation 1 [mp4a]
adaptive debug: InitSegmentTemplate #0 url=http://192.168.0.181:81/300/audio/1/audio_4.mp4 duration 0
adaptive debug: SegmentTemplate #12 url=http://192.168.0.181:81/300/audio/1/$Time$.m4s duration 0
...
adaptive debug: Timeline
adaptive debug: Element #1 d=576576 r=0 @t=6990865
adaptive debug: Element #2 d=669670 r=0 @t=7567441
adaptive debug: Element #3 d=672673 r=0 @t=8237111
adaptive debug: Element #4 d=561561 r=0 @t=8909784
adaptive debug: Element #5 d=654655 r=0 @t=9471345
adaptive debug: Element #6 d=630631 r=0 @t=10126000
adaptive debug: Element #7 d=666666 r=0 @t=10756631
adaptive debug: Updated MPD, next update in 7s
main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 2168 ms)
main debug: ES_OUT_RESET_PCR called
main debug: Buffering 0%
main debug: Buffering 1%
main debug: Buffering 2%
main debug: Received first picture
mmdevice debug: state changed: 0
main debug: Buffering 4%
...
main debug: Buffering 15%
wasapi debug: reset
main debug: Buffering 17%
...
main debug: Buffering 98%
main debug: Stream buffering done (2176 ms in 16 ms)
main debug: Decoder wait done in 0 ms
main warning: playback too early (-110003): down-sampling
mmdevice debug: state changed: 1
adaptive debug: Retrieving http://192.168.0.181:81/300/video/0/10129840.m4s @0
adaptive debug: Retrieving http://192.168.0.181:81/300/audio/5/10081200.m4s @0
adaptive debug: Retrieving http://192.168.0.181:81/300/300.mpd @0
main debug: creating access: http://192.168.0.181:81/300/300.mpd
main debug: (path: \192.168.0.181:81300300.mpd)
main debug: looking for access module matching "http": 26 candidates
http debug: resolving 192.168.0.181 ...
http debug: outgoing request: GET /300/300.mpd HTTP/1.1 Host: 192.168.0.181:81 Accept: */* Accept-Language: en_US User-Agent: VLC/3.0.11 LibVLC/3.0.11 Range: bytes=0-
http debug: incoming response: HTTP/1.1 206 Partial Content Server: nginx Date: Mon, 17 Aug 2020 09:10:15 GMT Content-Type: application/octet-stream Content-Length: 10387 Last-Modified: Mon, 17 Aug 2020 09:10:15 GMT Connection: keep-alive ETag: "5f3a4977-2893" Content-Range: bytes 0-10386/10387
main debug: using access module "access"
main debug: looking for stream_filter module matching "prefetch,cache_block": 24 candidates
prefetch debug: using 10387 bytes buffer, 10387 bytes read
main debug: using stream_filter module "prefetch"
main debug: looking for stream_filter module matching "any": 24 candidates
main debug: no stream_filter modules matched
main debug: looking for stream_filter module matching "inflate": 24 candidates
main debug: no stream_filter modules matched
prefetch debug: end of stream
main debug: removing module "prefetch"
main debug: removing module "access"
main debug: looking for xml reader module matching "any": 1 candidates
main debug: using xml reader module "xml"
adaptive debug: MPD profile=urn:mpeg:dash:profile:isoff-live:2011 mediaPresentationDuration=0 minBufferTime=2
adaptive debug: BaseUrl=http://192.168.0.181:81/300/
adaptive debug: Period
adaptive debug: BaseAdaptationSet 0
adaptive debug: Representation 0 [mp4a]
adaptive debug: InitSegmentTemplate #0 url=http://192.168.0.181:81/300/audio/0/audio_4.mp4 duration 0
adaptive debug: SegmentTemplate #13 url=http://192.168.0.181:81/300/audio/0/$Time$.m4s duration 0
...
продолжаю получать похожие сообщения
предупреждение vlc и сообщения об ошибках при длительности 5
adaptive debug: Timeline
adaptive debug: Element #1 d=456457 r=0 @t=9501375
adaptive debug: Element #2 d=453453 r=0 @t=9957832
adaptive debug: Element #3 d=471472 r=0 @t=10411285
adaptive debug: Element #4 d=381381 r=0 @t=10882757
adaptive debug: Element #5 d=477478 r=0 @t=11264138
adaptive debug: Element #6 d=468468 r=0 @t=11741616
adaptive debug: Element #7 d=474475 r=0 @t=12210084
adaptive debug: Element #8 d=378378 r=0 @t=12684559
adaptive debug: Element #9 d=468468 r=0 @t=13062937
adaptive debug: Element #10 d=474475 r=0 @t=13531405
adaptive debug: Updated MPD, next update in 5s
adaptive debug: Retrieving http://192.168.0.181:81/300/audio/5/8101680.m4s @0
main error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 4794 ms)
main warning: buffer too late (-588333 us): dropped
main debug: ES_OUT_RESET_PCR called
main debug: Buffering 0%
main debug: Buffering 1%
main debug: Buffering 2%
main debug: Buffering 3%
...
main debug: Buffering 15%
main debug: Received first picture
main debug: Buffering 16%
...
main debug: Buffering 99%
main debug: Stream buffering done (4804 ms in 122 ms)
main debug: Decoder wait done in 0 ms
main debug: inserting 3246 zeroes
mmdevice debug: state changed: 0
wasapi debug: reset
main warning: playback too early (-85958): down-sampling
mmdevice debug: state changed: 1
adaptive debug: Retrieving http://192.168.0.181:81/300/video/0/8114825.m4s @0
adaptive debug: Retrieving http://192.168.0.181:81/300/300.mpd @0
main debug: creating access: http://192.168.0.181:81/300/300.mpd
main debug: (path: \192.168.0.181:81300300.mpd)
main debug: looking for access module matching "http": 26 candidates
http debug: resolving 192.168.0.181 ...
http debug: outgoing request: GET /300/300.mpd HTTP/1.1 Host: 192.168.0.181:81 Accept: */* Accept-Language: en_US User-Agent: VLC/3.0.11 LibVLC/3.0.11 Range: bytes=0-
http debug: incoming response: HTTP/1.1 206 Partial Content Server: nginx Date: Mon, 17 Aug 2020 09:18:28 GMT Content-Type: application/octet-stream Content-Length: 12632 Last-Modified: Mon, 17 Aug 2020 09:18:28 GMT Connection: keep-alive ETag: "5f3a4b64-3158" Content-Range: bytes 0-12631/12632
main debug: using access module "access"
main debug: looking for stream_filter module matching "prefetch,cache_block": 24 candidates
prefetch debug: using 12632 bytes buffer, 12632 bytes read
main debug: using stream_filter module "prefetch"
main debug: looking for stream_filter module matching "any": 24 candidates
main debug: no stream_filter modules matched
main debug: looking for stream_filter module matching "inflate": 24 candidates
main debug: no stream_filter modules matched
prefetch debug: end of stream
main debug: removing module "prefetch"
main debug: removing module "access"
main debug: looking for xml reader module matching "any": 1 candidates
main debug: using xml reader module "xml"
adaptive debug: MPD profile=urn:mpeg:dash:profile:isoff-live:2011 mediaPresentationDuration=0 minBufferTime=2
adaptive debug: BaseUrl=http://192.168.0.181:81/300/
adaptive debug: Period
adaptive debug: BaseAdaptationSet 0
adaptive debug: Representation 0 [mp4a]
adaptive debug: InitSegmentTemplate #0 url=http://192.168.0.181:81/300/audio/0/audio_4.mp4 duration 0
adaptive debug: SegmentTemplate #12 url=http://192.168.0.181:81/300/audio/0/$Time$.m4s duration 0
...
adaptive debug: Timeline
adaptive debug: Element #1 d=453453 r=0 @t=9957832
adaptive debug: Element #2 d=471472 r=0 @t=10411285
adaptive debug: Element #3 d=381381 r=0 @t=10882757
adaptive debug: Element #4 d=477478 r=0 @t=11264138
adaptive debug: Element #5 d=468468 r=0 @t=11741616
adaptive debug: Element #6 d=474475 r=0 @t=12210084
adaptive debug: Element #7 d=378378 r=0 @t=12684559
adaptive debug: Element #8 d=468468 r=0 @t=13062937
adaptive debug: Element #9 d=474475 r=0 @t=13531405
adaptive debug: Element #10 d=459459 r=0 @t=14005880
adaptive debug: Updated MPD, next update in 5s
adaptive debug: Retrieving http://192.168.0.181:81/300/audio/5/8550960.m4s @0
main warning: picture is too late to be displayed (missing 383 ms)
main warning: picture is too late to be displayed (missing 317 ms)
main warning: picture is too late to be displayed (missing 251 ms)
main warning: picture is too late to be displayed (missing 184 ms)
main warning: picture is too late to be displayed (missing 117 ms)
adaptive debug: Retrieving http://192.168.0.181:81/300/300.mpd @0
main debug: creating access: http://192.168.0.181:81/300/300.mpd
main debug: (path: \192.168.0.181:81300300.mpd)
main debug: looking for access module matching "http": 26 candidates
http debug: resolving 192.168.0.181 ...
http debug: outgoing request: GET /300/300.mpd HTTP/1.1 Host: 192.168.0.181:81 Accept: */* Accept-Language: en_US User-Agent: VLC/3.0.11 LibVLC/3.0.11 Range: bytes=0-
http debug: incoming response: HTTP/1.1 206 Partial Content Server: nginx Date: Mon, 17 Aug 2020 09:18:33 GMT Content-Type: application/octet-stream Content-Length: 12596 Last-Modified: Mon, 17 Aug 2020 09:18:33 GMT Connection: keep-alive ETag: "5f3a4b69-3134" Content-Range: bytes 0-12595/12596
main debug: using access module "access"
main debug: looking for stream_filter module matching "prefetch,cache_block": 24 candidates
prefetch debug: using 12596 bytes buffer, 12596 bytes read
main debug: using stream_filter module "prefetch"
main debug: looking for stream_filter module matching "any": 24 candidates
main debug: no stream_filter modules matched
main debug: looking for stream_filter module matching "inflate": 24 candidates
main debug: no stream_filter modules matched
prefetch debug: end of stream
main debug: removing module "prefetch"
main debug: removing module "access"
main debug: looking for xml reader module matching "any": 1 candidates
main debug: using xml reader module "xml"
adaptive debug: MPD profile=urn:mpeg:dash:profile:isoff-live:2011 mediaPresentationDuration=0 minBufferTime=2
adaptive debug: BaseUrl=http://192.168.0.181:81/300/
adaptive debug: Period
adaptive debug: BaseAdaptationSet 0
adaptive debug: Representation 0 [mp4a]
adaptive debug: InitSegmentTemplate #0 url=http://192.168.0.181:81/300/audio/0/audio_4.mp4 duration 0
adaptive debug: SegmentTemplate #13 url=http://192.168.0.181:81/300/audio/0/$Time$.m4s duration 0
...
продолжаю получать похожие сообщения
Это воспроизводится на vlc. это длится 10 секунд. но я хочу, чтобы продолжительность прямой трансляции была меньше 5. cuda, частота кадров, размер GOP и битрейт исправлены.
Я знаю, что это неэффективно. но теперь мне нужно, чтобы продолжительность просмотра канала multiview в режиме реального времени была меньше 5. Как я могу этого добиться? пожалуйста, помогите мне.