I am experiencing a problem with significant (several seconds) and variable delay on media sources to OBS, which will make it impossible to sync the programme video to sound.
Test Configuration. 4 identical IP cameras streaming via IP switch into ethernet port, OBS with 4 scenes, each with a media source receiving the RTSP stream, and a 5th scene which shows all 4 sources to more easily demonstrate the problem. There is no audio source yet.
The video streams are H264 30fps CBR 1s iFrame interval, testing initially at 1080p 6Mbps but then retested at 720p 1.5Mbps - with the same problem results. OBS canvas size matched the input streams in each case. Test results below are for the 720p testing.
Test Sequence. On startup of OBS the 4 streams are synchronised and about 1 second behind real time. This remains stable for several minutes.
However as soon as I implement a transition between scenes, significant delay variations arise, with the source in the scene switched to having least delay. After several transitions a delay of 5-7 seconds has built up. See the linked video stream recording.
Adding 4 instances of VLC on the same PC (not as sources to OBS) enabled the 4 RTSP streams to be displayed, and shows that these streams continue to remain synchronised, and that the delay issue is within OBS.
OBS shows zero frames missed due to rendering lag and no output dropped frames, with average time to render frame at 2.5ms.
The issue occurs whether or not I am streaming, and whether or not in Studio mode.
The CPU (i7 4 core) loading is typically 7% before streaming and then 20-25% during streaming so processor resource seems unlikely to be an issue.
Evidence See OBS Log below and this link to the related video stream recording.
Solution Any suggestions welcome! I don't think my use case can be that unusual, and whilst I would expect some small delay variations, these variations of multiple seconds are a complete surprise and I can't imagine what might be causing it! I've not seen anything similar previously using capture cards and USB sources. I am aware of the options to adjust fixed delays using video filters and the sound delay adjustment, but that won't help me given the variable nature of the delays I am experiencing. A big thank you to those experts out there offering so much support!
Best wishes,
John
OBS Log
19:03:46.627: CPU Name: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
19:03:46.628: CPU Speed: 3408MHz
19:03:46.628: Physical Cores: 4, Logical Cores: 8
19:03:46.628: Physical Memory: 16270MB Total, 11201MB Free
19:03:46.628: Windows Version: 10.0 Build 18363 (release: 1909; revision: 1316; 64-bit)
19:03:46.628: Running as administrator: false
19:03:46.628: Aero is Enabled (Aero is always on for windows 8 and above)
19:03:46.628: Windows 10 Gaming Features:
19:03:46.628: Game DVR: On
19:03:46.630: Sec. Software Status:
19:03:46.631: AVG Antivirus: enabled (AV)
19:03:46.631: Windows Defender Antivirus: disabled (AV)
19:03:46.632: Windows Firewall: enabled (FW)
19:03:46.633: Current Date/Time: 2021-02-21, 19:03:46
19:03:46.633: Browser Hardware Acceleration: true
19:03:46.633: Portable mode: false
19:03:46.831: OBS 26.1.1 (64-bit, windows)
19:03:46.831: ---------------------------------
19:03:46.876: ---------------------------------
19:03:46.876: audio settings reset:
19:03:46.876: samples per sec: 48000
19:03:46.876: speakers: 2
19:03:46.877: ---------------------------------
19:03:46.877: Initializing D3D11...
19:03:46.877: Available Video Adapters:
19:03:46.879: Adapter 0: Intel(R) HD Graphics 530
19:03:46.879: Dedicated VRAM: 134217728
19:03:46.879: Shared VRAM: 4235251712
19:03:46.879: PCI ID: 8086:1912
19:03:46.880: Driver Version: 27.20.100.8681
19:03:46.880: output 0: pos={0, 0}, size={1920, 1080}, attached=true, refresh=59, name=EK220Q
19:03:46.882: Loading up D3D11 on adapter Intel(R) HD Graphics 530 (0)
19:03:46.900: D3D11 loaded successfully, feature level used: b000
19:03:46.900: DXGI increase maximum frame latency success
19:03:47.345: ---------------------------------
19:03:47.345: video settings reset:
19:03:47.345: base resolution: 1280x720
19:03:47.345: output resolution: 1280x720
19:03:47.345: downscale filter: Bicubic
19:03:47.345: fps: 30/1
19:03:47.345: format: NV12
19:03:47.345: YUV mode: 709/Partial
19:03:47.345: NV12 texture support not available
19:03:47.346: Audio monitoring device:
19:03:47.346: name: Default
19:03:47.346: id: default
19:03:47.348: ---------------------------------
19:03:47.353: [CoreAudio encoder]: CoreAudio AAC encoder not installed on the system or couldn't be loaded
19:03:47.354: Failed to load 'en-US' text for module: 'decklink-captions.dll'
19:03:47.354: Failed to load 'en-US' text for module: 'decklink-ouput-ui.dll'
19:03:47.396: [AMF] Unable to load 'amfrt64.dll', error code 126.
19:03:47.399: [AMF] AMF Test failed due to one or more errors.
19:03:47.399: Failed to initialize module 'enc-amf.dll'
19:03:47.418: [obs-browser]: Version 2.9.1
19:03:47.418: [obs-browser]: CEF Version 75.1.16+g16a67c4+chromium-75.0.3770.100
19:03:47.458: VLC found, VLC video source enabled
19:03:47.465: A DeckLink iterator could not be created. The DeckLink drivers may not be installed
19:03:47.466: No blackmagic support
19:03:47.472: ---------------------------------
19:03:47.472: Loaded Modules:
19:03:47.472: win-wasapi.dll
19:03:47.472: win-mf.dll
19:03:47.472: win-dshow.dll
19:03:47.472: win-decklink.dll
19:03:47.472: win-capture.dll
19:03:47.472: vlc-video.dll
19:03:47.472: text-freetype2.dll
19:03:47.472: rtmp-services.dll
19:03:47.472: obs-x264.dll
19:03:47.472: obs-vst.dll
19:03:47.472: obs-transitions.dll
19:03:47.472: obs-text.dll
19:03:47.472: obs-qsv11.dll
19:03:47.472: obs-outputs.dll
19:03:47.472: obs-filters.dll
19:03:47.472: obs-ffmpeg.dll
19:03:47.472: obs-browser.dll
19:03:47.472: image-source.dll
19:03:47.472: frontend-tools.dll
19:03:47.472: enc-amf.dll
19:03:47.472: decklink-ouput-ui.dll
19:03:47.472: decklink-captions.dll
19:03:47.472: coreaudio-encoder.dll
19:03:47.472: ---------------------------------
19:03:47.473: ==== Startup complete ===============================================
19:03:47.495: Switched to Preview/Program mode
19:03:47.495: ------------------------------------------------
19:03:47.499: All scene data cleared
19:03:47.499: ------------------------------------------------
19:03:47.561: WASAPI: Device 'EK220Q (Intel(R) Display Audio)' [48000 Hz] initialized
19:03:47.561: [Loaded global audio device]: 'Desktop Audio'
19:03:47.563: [Media Source 'Cam1']: settings:
19:03:47.563: input: rtsp://admin:*********@192.168.68.12:554/&Channel=1&stream=0.sdp?real_stream
19:03:47.563: input_format:
19:03:47.563: speed: 100
19:03:47.563: is_looping: no
19:03:47.563: is_hw_decoding: no
19:03:47.563: is_clear_on_media_end: no
19:03:47.563: restart_on_activate: yes
19:03:47.563: close_when_inactive: no
19:03:47.564: [Media Source 'Cam2']: settings:
19:03:47.564: input: rtsp://admin:*********@192.168.68.11:554/&Channel=1&stream=0.sdp?real_stream
19:03:47.564: input_format:
19:03:47.564: speed: 100
19:03:47.564: is_looping: no
19:03:47.564: is_hw_decoding: no
19:03:47.564: is_clear_on_media_end: no
19:03:47.564: restart_on_activate: yes
19:03:47.564: close_when_inactive: no
19:03:47.565: [Media Source 'Cam3']: settings:
19:03:47.565: input: rtsp://admin:*********@192.168.68.120:554/&Channel=1&stream=0.sdp?real_stream
19:03:47.565: input_format:
19:03:47.565: speed: 100
19:03:47.565: is_looping: no
19:03:47.565: is_hw_decoding: no
19:03:47.565: is_clear_on_media_end: no
19:03:47.565: restart_on_activate: yes
19:03:47.565: close_when_inactive: no
19:03:47.566: [Media Source 'Cam4']: settings:
19:03:47.566: input: rtsp://admin:*********@192.168.68.16:554/&Channel=1&stream=0.sdp?real_stream
19:03:47.566: input_format:
19:03:47.566: speed: 100
19:03:47.566: is_looping: no
19:03:47.566: is_hw_decoding: no
19:03:47.566: is_clear_on_media_end: no
19:03:47.566: restart_on_activate: yes
19:03:47.566: close_when_inactive: no
19:03:47.567: Switched to scene 'Cam 4'
19:03:47.570: ------------------------------------------------
19:03:47.570: Loaded scenes:
19:03:47.570: - scene 'Cam 1':
19:03:47.570: - source: 'Cam1' (ffmpeg_source)
19:03:47.570: - scene 'Cam 2':
19:03:47.570: - source: 'Cam2' (ffmpeg_source)
19:03:47.570: - scene 'Cam 3':
19:03:47.570: - source: 'Cam3' (ffmpeg_source)
19:03:47.570: - scene 'Cam 4':
19:03:47.570: - source: 'Cam4' (ffmpeg_source)
19:03:47.570: - scene 'Mix':
19:03:47.570: - source: 'Cam1' (ffmpeg_source)
19:03:47.570: - source: 'Cam2' (ffmpeg_source)
19:03:47.570: - source: 'Cam3' (ffmpeg_source)
19:03:47.570: - source: 'Cam4' (ffmpeg_source)
19:03:47.570: ------------------------------------------------
19:04:21.334: ---------------------------------
19:04:21.334: [x264 encoder: 'streaming_h264'] preset: veryfast
19:04:21.334: [x264 encoder: 'streaming_h264'] settings:
19:04:21.334: rate_control: CBR
19:04:21.334: bitrate: 2500
19:04:21.334: buffer size: 2500
19:04:21.334: crf: 0
19:04:21.334: fps_num: 30
19:04:21.334: fps_den: 1
19:04:21.334: width: 1280
19:04:21.334: height: 720
19:04:21.334: keyint: 60
19:04:21.334:
19:04:21.337: ---------------------------------
19:04:21.337: [FFmpeg aac encoder: 'adv_stream_aac'] bitrate: 160, channels: 2, channel_layout: 3
19:04:21.337:
19:04:21.338: [rtmp stream: 'adv_stream'] Connecting to RTMP URL rtmp://a.rtmp.youtube.com/live2...
19:04:21.368: [rtmp stream: 'adv_stream'] Interface: Intel(R) Ethernet Connection (2) I219-LM (ethernet, 1000 mbps)
19:04:21.636: [rtmp stream: 'adv_stream'] Connection to rtmp://a.rtmp.youtube.com/live2 successful
19:04:21.640: ==== Streaming Start ===============================================
19:05:03.358: User switched to scene 'Mix'
19:05:05.889: User switched to scene 'Cam 4'
19:05:19.813: User switched to scene 'Cam 3'
19:05:22.096: User switched to scene 'Mix'
19:05:24.421: User switched to scene 'Cam 3'
19:05:42.689: User switched to scene 'Cam 2'
19:05:44.559: User switched to scene 'Mix'
19:05:47.023: User switched to scene 'Cam 2'
19:06:15.685: [rtmp stream: 'adv_stream'] User stopped the stream
19:06:15.685: Output 'adv_stream': stopping
19:06:15.685: Output 'adv_stream': Total frames output: 3395
19:06:15.685: Output 'adv_stream': Total drawn frames: 3431
19:06:15.689: ==== Streaming Stop ================================================
Test Configuration. 4 identical IP cameras streaming via IP switch into ethernet port, OBS with 4 scenes, each with a media source receiving the RTSP stream, and a 5th scene which shows all 4 sources to more easily demonstrate the problem. There is no audio source yet.
The video streams are H264 30fps CBR 1s iFrame interval, testing initially at 1080p 6Mbps but then retested at 720p 1.5Mbps - with the same problem results. OBS canvas size matched the input streams in each case. Test results below are for the 720p testing.
Test Sequence. On startup of OBS the 4 streams are synchronised and about 1 second behind real time. This remains stable for several minutes.
However as soon as I implement a transition between scenes, significant delay variations arise, with the source in the scene switched to having least delay. After several transitions a delay of 5-7 seconds has built up. See the linked video stream recording.
Adding 4 instances of VLC on the same PC (not as sources to OBS) enabled the 4 RTSP streams to be displayed, and shows that these streams continue to remain synchronised, and that the delay issue is within OBS.
OBS shows zero frames missed due to rendering lag and no output dropped frames, with average time to render frame at 2.5ms.
The issue occurs whether or not I am streaming, and whether or not in Studio mode.
The CPU (i7 4 core) loading is typically 7% before streaming and then 20-25% during streaming so processor resource seems unlikely to be an issue.
Evidence See OBS Log below and this link to the related video stream recording.
Solution Any suggestions welcome! I don't think my use case can be that unusual, and whilst I would expect some small delay variations, these variations of multiple seconds are a complete surprise and I can't imagine what might be causing it! I've not seen anything similar previously using capture cards and USB sources. I am aware of the options to adjust fixed delays using video filters and the sound delay adjustment, but that won't help me given the variable nature of the delays I am experiencing. A big thank you to those experts out there offering so much support!
Best wishes,
John
OBS Log
19:03:46.627: CPU Name: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
19:03:46.628: CPU Speed: 3408MHz
19:03:46.628: Physical Cores: 4, Logical Cores: 8
19:03:46.628: Physical Memory: 16270MB Total, 11201MB Free
19:03:46.628: Windows Version: 10.0 Build 18363 (release: 1909; revision: 1316; 64-bit)
19:03:46.628: Running as administrator: false
19:03:46.628: Aero is Enabled (Aero is always on for windows 8 and above)
19:03:46.628: Windows 10 Gaming Features:
19:03:46.628: Game DVR: On
19:03:46.630: Sec. Software Status:
19:03:46.631: AVG Antivirus: enabled (AV)
19:03:46.631: Windows Defender Antivirus: disabled (AV)
19:03:46.632: Windows Firewall: enabled (FW)
19:03:46.633: Current Date/Time: 2021-02-21, 19:03:46
19:03:46.633: Browser Hardware Acceleration: true
19:03:46.633: Portable mode: false
19:03:46.831: OBS 26.1.1 (64-bit, windows)
19:03:46.831: ---------------------------------
19:03:46.876: ---------------------------------
19:03:46.876: audio settings reset:
19:03:46.876: samples per sec: 48000
19:03:46.876: speakers: 2
19:03:46.877: ---------------------------------
19:03:46.877: Initializing D3D11...
19:03:46.877: Available Video Adapters:
19:03:46.879: Adapter 0: Intel(R) HD Graphics 530
19:03:46.879: Dedicated VRAM: 134217728
19:03:46.879: Shared VRAM: 4235251712
19:03:46.879: PCI ID: 8086:1912
19:03:46.880: Driver Version: 27.20.100.8681
19:03:46.880: output 0: pos={0, 0}, size={1920, 1080}, attached=true, refresh=59, name=EK220Q
19:03:46.882: Loading up D3D11 on adapter Intel(R) HD Graphics 530 (0)
19:03:46.900: D3D11 loaded successfully, feature level used: b000
19:03:46.900: DXGI increase maximum frame latency success
19:03:47.345: ---------------------------------
19:03:47.345: video settings reset:
19:03:47.345: base resolution: 1280x720
19:03:47.345: output resolution: 1280x720
19:03:47.345: downscale filter: Bicubic
19:03:47.345: fps: 30/1
19:03:47.345: format: NV12
19:03:47.345: YUV mode: 709/Partial
19:03:47.345: NV12 texture support not available
19:03:47.346: Audio monitoring device:
19:03:47.346: name: Default
19:03:47.346: id: default
19:03:47.348: ---------------------------------
19:03:47.353: [CoreAudio encoder]: CoreAudio AAC encoder not installed on the system or couldn't be loaded
19:03:47.354: Failed to load 'en-US' text for module: 'decklink-captions.dll'
19:03:47.354: Failed to load 'en-US' text for module: 'decklink-ouput-ui.dll'
19:03:47.396: [AMF] Unable to load 'amfrt64.dll', error code 126.
19:03:47.399: [AMF] AMF Test failed due to one or more errors.
19:03:47.399: Failed to initialize module 'enc-amf.dll'
19:03:47.418: [obs-browser]: Version 2.9.1
19:03:47.418: [obs-browser]: CEF Version 75.1.16+g16a67c4+chromium-75.0.3770.100
19:03:47.458: VLC found, VLC video source enabled
19:03:47.465: A DeckLink iterator could not be created. The DeckLink drivers may not be installed
19:03:47.466: No blackmagic support
19:03:47.472: ---------------------------------
19:03:47.472: Loaded Modules:
19:03:47.472: win-wasapi.dll
19:03:47.472: win-mf.dll
19:03:47.472: win-dshow.dll
19:03:47.472: win-decklink.dll
19:03:47.472: win-capture.dll
19:03:47.472: vlc-video.dll
19:03:47.472: text-freetype2.dll
19:03:47.472: rtmp-services.dll
19:03:47.472: obs-x264.dll
19:03:47.472: obs-vst.dll
19:03:47.472: obs-transitions.dll
19:03:47.472: obs-text.dll
19:03:47.472: obs-qsv11.dll
19:03:47.472: obs-outputs.dll
19:03:47.472: obs-filters.dll
19:03:47.472: obs-ffmpeg.dll
19:03:47.472: obs-browser.dll
19:03:47.472: image-source.dll
19:03:47.472: frontend-tools.dll
19:03:47.472: enc-amf.dll
19:03:47.472: decklink-ouput-ui.dll
19:03:47.472: decklink-captions.dll
19:03:47.472: coreaudio-encoder.dll
19:03:47.472: ---------------------------------
19:03:47.473: ==== Startup complete ===============================================
19:03:47.495: Switched to Preview/Program mode
19:03:47.495: ------------------------------------------------
19:03:47.499: All scene data cleared
19:03:47.499: ------------------------------------------------
19:03:47.561: WASAPI: Device 'EK220Q (Intel(R) Display Audio)' [48000 Hz] initialized
19:03:47.561: [Loaded global audio device]: 'Desktop Audio'
19:03:47.563: [Media Source 'Cam1']: settings:
19:03:47.563: input: rtsp://admin:*********@192.168.68.12:554/&Channel=1&stream=0.sdp?real_stream
19:03:47.563: input_format:
19:03:47.563: speed: 100
19:03:47.563: is_looping: no
19:03:47.563: is_hw_decoding: no
19:03:47.563: is_clear_on_media_end: no
19:03:47.563: restart_on_activate: yes
19:03:47.563: close_when_inactive: no
19:03:47.564: [Media Source 'Cam2']: settings:
19:03:47.564: input: rtsp://admin:*********@192.168.68.11:554/&Channel=1&stream=0.sdp?real_stream
19:03:47.564: input_format:
19:03:47.564: speed: 100
19:03:47.564: is_looping: no
19:03:47.564: is_hw_decoding: no
19:03:47.564: is_clear_on_media_end: no
19:03:47.564: restart_on_activate: yes
19:03:47.564: close_when_inactive: no
19:03:47.565: [Media Source 'Cam3']: settings:
19:03:47.565: input: rtsp://admin:*********@192.168.68.120:554/&Channel=1&stream=0.sdp?real_stream
19:03:47.565: input_format:
19:03:47.565: speed: 100
19:03:47.565: is_looping: no
19:03:47.565: is_hw_decoding: no
19:03:47.565: is_clear_on_media_end: no
19:03:47.565: restart_on_activate: yes
19:03:47.565: close_when_inactive: no
19:03:47.566: [Media Source 'Cam4']: settings:
19:03:47.566: input: rtsp://admin:*********@192.168.68.16:554/&Channel=1&stream=0.sdp?real_stream
19:03:47.566: input_format:
19:03:47.566: speed: 100
19:03:47.566: is_looping: no
19:03:47.566: is_hw_decoding: no
19:03:47.566: is_clear_on_media_end: no
19:03:47.566: restart_on_activate: yes
19:03:47.566: close_when_inactive: no
19:03:47.567: Switched to scene 'Cam 4'
19:03:47.570: ------------------------------------------------
19:03:47.570: Loaded scenes:
19:03:47.570: - scene 'Cam 1':
19:03:47.570: - source: 'Cam1' (ffmpeg_source)
19:03:47.570: - scene 'Cam 2':
19:03:47.570: - source: 'Cam2' (ffmpeg_source)
19:03:47.570: - scene 'Cam 3':
19:03:47.570: - source: 'Cam3' (ffmpeg_source)
19:03:47.570: - scene 'Cam 4':
19:03:47.570: - source: 'Cam4' (ffmpeg_source)
19:03:47.570: - scene 'Mix':
19:03:47.570: - source: 'Cam1' (ffmpeg_source)
19:03:47.570: - source: 'Cam2' (ffmpeg_source)
19:03:47.570: - source: 'Cam3' (ffmpeg_source)
19:03:47.570: - source: 'Cam4' (ffmpeg_source)
19:03:47.570: ------------------------------------------------
19:04:21.334: ---------------------------------
19:04:21.334: [x264 encoder: 'streaming_h264'] preset: veryfast
19:04:21.334: [x264 encoder: 'streaming_h264'] settings:
19:04:21.334: rate_control: CBR
19:04:21.334: bitrate: 2500
19:04:21.334: buffer size: 2500
19:04:21.334: crf: 0
19:04:21.334: fps_num: 30
19:04:21.334: fps_den: 1
19:04:21.334: width: 1280
19:04:21.334: height: 720
19:04:21.334: keyint: 60
19:04:21.334:
19:04:21.337: ---------------------------------
19:04:21.337: [FFmpeg aac encoder: 'adv_stream_aac'] bitrate: 160, channels: 2, channel_layout: 3
19:04:21.337:
19:04:21.338: [rtmp stream: 'adv_stream'] Connecting to RTMP URL rtmp://a.rtmp.youtube.com/live2...
19:04:21.368: [rtmp stream: 'adv_stream'] Interface: Intel(R) Ethernet Connection (2) I219-LM (ethernet, 1000 mbps)
19:04:21.636: [rtmp stream: 'adv_stream'] Connection to rtmp://a.rtmp.youtube.com/live2 successful
19:04:21.640: ==== Streaming Start ===============================================
19:05:03.358: User switched to scene 'Mix'
19:05:05.889: User switched to scene 'Cam 4'
19:05:19.813: User switched to scene 'Cam 3'
19:05:22.096: User switched to scene 'Mix'
19:05:24.421: User switched to scene 'Cam 3'
19:05:42.689: User switched to scene 'Cam 2'
19:05:44.559: User switched to scene 'Mix'
19:05:47.023: User switched to scene 'Cam 2'
19:06:15.685: [rtmp stream: 'adv_stream'] User stopped the stream
19:06:15.685: Output 'adv_stream': stopping
19:06:15.685: Output 'adv_stream': Total frames output: 3395
19:06:15.685: Output 'adv_stream': Total drawn frames: 3431
19:06:15.689: ==== Streaming Stop ================================================