exeldro / obs-source-record

GNU General Public License v2.0
333 stars 37 forks source link

Sometimes main recording file is corrupted when enable replay buffer #68

Open birdbyrd opened 1 year ago

birdbyrd commented 1 year ago

Hi! First of all, Thanks for the great plug in.

I have a little issue when enable replay buffer. The buffer does working great but somehow it impact the main recording file of that video source (the recording that the plugin create, not the one that OBS create) .

Environment:

Full log file for this particular OBS session: 2022-12-11 22-12-47.txt

Description:

I have 2 video sources that enable with source-record plugin. Both have buffer enabled with 30s duration.

# SOURCE 1
22:12:48.736:     - source: 'Elgato Capture Card' (av_capture_input)
22:12:48.736:         - filter: 'Source Record Gamplay' (source_record_filter)

# SOURCE 2
22:12:48.736:     - source: 'BirdByrd iPhone' (av_capture_input)
22:12:48.736:         - filter: 'Background Removal' (background_removal)
22:12:48.736:         - filter: 'Chroma Key' (chroma_key_filter_v2)
22:12:48.736:         - filter: 'cirlcle mask' (mask_filter_v2)
22:12:48.736:         - filter: 'rectangle mask' (mask_filter_v2)
22:12:48.736:         - filter: 'square mask' (mask_filter_v2)
22:12:48.736:         - filter: 'rectangle mask extended' (mask_filter_v2)
22:12:48.736:         - filter: 'Source Record Facecam' (source_record_filter)

# Setting of the plug in of each sources

22:12:48.782: [VideoToolbox Source Record Gamplay: 'h264']: session created with hardware encoding
22:12:48.795: [VideoToolbox Source Record Gamplay: 'h264']: settings:
22:12:48.795:   vt_encoder_id          com.apple.videotoolbox.videoencoder.ave.avc
22:12:48.795:   rate_control:          CRF
22:12:48.795:   bitrate:               18000 (kbps)
22:12:48.795:   quality:               0.600000
22:12:48.795:   fps_num:               60
22:12:48.795:   fps_den:               1
22:12:48.795:   width:                 1920
22:12:48.795:   height:                1080
22:12:48.795:   keyint:                2 (s)
22:12:48.795:   limit_bitrate:         off
22:12:48.795:   rc_max_bitrate:        2500 (kbps)
22:12:48.795:   rc_max_bitrate_window: 1.500000 (s)
22:12:48.795:   hw_enc:                on
22:12:48.795:   profile:               main
22:12:48.795: 
22:12:48.795: ---------------------------------
22:12:48.795: [FFmpeg aac encoder: 'Source Record Gamplay'] bitrate: 128, channels: 2, channel_layout: 3
22:12:48.795: 
22:12:49.272: [VideoToolbox Source Record Facecam: 'h264']: settings:
22:12:49.272:   vt_encoder_id          com.apple.videotoolbox.videoencoder.h264
22:12:49.272:   rate_control:          ABR
22:12:49.272:   bitrate:               5000 (kbps)
22:12:49.272:   quality:               0.400000
22:12:49.272:   fps_num:               60
22:12:49.272:   fps_den:               1
22:12:49.272:   width:                 960
22:12:49.272:   height:                540
22:12:49.272:   keyint:                0 (s)
22:12:49.272:   limit_bitrate:         off
22:12:49.272:   rc_max_bitrate:        2500 (kbps)
22:12:49.272:   rc_max_bitrate_window: 1.500000 (s)
22:12:49.272:   hw_enc:                off
22:12:49.272:   profile:               baseline
22:12:49.272: 
22:12:49.272: ---------------------------------
22:12:49.272: [FFmpeg aac encoder: 'Source Record Facecam'] bitrate: 128, channels: 2, channel_layout: 3

During the stream session :

22:13:05.436: ==== Streaming Start ===============================================
22:13:05.437: [ffmpeg muxer: 'Source Record Facecam'] Writing file '/Users/chakkapanrapeepunpienpen/Movies/obs/facecam-2022-12-11 22-13-05.mp4'...
22:13:05.437: [ffmpeg muxer: 'Source Record Gamplay'] Writing file '/Users/chakkapanrapeepunpienpen/Movies/obs/nocommentary-2022-12-11 22-13-05.mp4'...

22:13:31.847: hotkeys-cocoa: Using layout 'com.apple.keylayout.Thai'
22:13:57.340: [ffmpeg muxer: 'Elgato Capture Card - Source Record Gamplay'] Wrote replay buffer to '/Users/chakkapanrapeepunpienpen/Movies/obs/nocommentary-2022-12-11 22-13-57.mp4'
22:13:57.341: [ffmpeg muxer: 'BirdByrd iPhone - Source Record Facecam'] Wrote replay buffer to '/Users/chakkapanrapeepunpienpen/Movies/obs/facecam-2022-12-11 22-13-57.mp4'
22:16:09.923: [ffmpeg muxer: 'BirdByrd iPhone - Source Record Facecam'] Wrote replay buffer to '/Users/chakkapanrapeepunpienpen/Movies/obs/facecam-2022-12-11 22-16-09.mp4'
22:16:09.956: [ffmpeg muxer: 'Elgato Capture Card - Source Record Gamplay'] Wrote replay buffer to '/Users/chakkapanrapeepunpienpen/Movies/obs/nocommentary-2022-12-11 22-16-09.mp4'
22:16:23.477: [rtmp stream: 'simple_stream'] User stopped the stream

Finally I stop the stream:

22:16:23.477: Output 'simple_stream': stopping
22:16:23.477: Output 'simple_stream': Total frames output: 11876
22:16:23.477: Output 'simple_stream': Total drawn frames: 11902 (11931 attempted)
22:16:23.477: Output 'simple_stream': Number of lagged frames due to rendering lag/stalls: 29 (0.2%)
22:16:23.480: ==== Streaming Stop ================================================

Note: