Question / Help Looping Videos Randomly Stopping Bug?

ayawnimouse

New Member
I have scenes with background videos that are supposed to be on loop, that restart on scene switch. No matter what settings I use for them, eventually they just freeze at some point. The only way I've been able to unfreeze them is to open the video properties in the source and click 'ok' in which case it reloads and rinse and repeat. I've tried toggling the view of the source too, if this worked I could put together a string of commands to get around it but it doesn't. One thing I haven't tried yet but am considering is moving it from a spinning harddisk to an ssd, maybe the delay in requesting the media file is causing some sort of timeout or something. I have noticed that when it freezes, its not at the end of the file most of the time. Either way, even if I move it to the ssd, I'm starting to get worried relying on OBS to utilize videos in the way I'm intending and as someone who keeps adding to my 'arsenal' of live streaming with new scenes, I feel like the more complex the more likely it is to fail for me which is discouraging.

I am on windows 10, and I'm running OBS 24.0.3.

I looked through the log files, it doesn't say anything about any media issues at all, its pretty vanilla in its logging, maybe I need to turn on a more verbose error logging? (Link to log file: https://obsproject.com/logs/lZKY03gmPaj1khoR)

Anyway, if anyone has any idea how to fix this it would be very very much appreciated. I'm so used to OBS now that I want to keep using it but since I have things synchronized with video backgrounds, my live feed looks like crap when the videos are just frozen instead of restarting. Thank you!
 

ayawnimouse

New Member
I moved all my videos to my SSD. I also removed all sources/media that were hidden or not used that I basically just disabled in the past. So my scenes are 'optimal' now. I'll report back if it FIXES the issue, but honestly, if it gets to a point that its bogged down from a couple inactive media, I don't know how I can trust OBS as a long term goto. If the SSD fixes the issue just due to timing out, maybe I won't run into that issue or at least lesson it, but it would be nice to know why it was happening and if there is a workaround.

Edit: I can now confirm that moving them to the SSD didn't fix the issue. I've also tried a 'restart media' hotkey, which doesn't work on the frozen video, but does if its playing properly.

So currently the only workaround that seems to work (and this is very bad) is to switch Scene Collections and then back. I have a Stream Deck to do this with strung together commands with delays (so it introduces a lot of dead time loading the collections twice).

So new bug (jesus), when it switches collections, it keeps adding a scene to which ever collection I switch to, the duplicate scene used to be at the bottom of my main collection. Since the bug, I've deleted that scene, but it keeps coming back now... I'm really saddened by this...

Edit 2: So I did a work around for the duplicating scene bug, I think it was due to how the new scene collection was made. I deleted it, then duplicated my old 'good' collection, then deleted all the scenes except a black empty one. Now I switch to that black empty scene in the new collection from the stream deck (wait 2 seconds for it to load with a delay), then switch back to a black empty scene in the 'good' collection. Wait another 2 seconds (so the fade transition can fire) Then switch to the scene with the background video, which forces the video to reload in a real way. This is insane to have to do this, but seems to work with a new 4 second delay between scene switching (which is awful). Hopefully someone can figure out a way to reload a video source forcibly.
 
Last edited:

carlmmii

Active Member
There should be no reason you have to do scene collection switching in order to fix video looping... something is definitely at fault with either the files, or the playback.

Could you possibly post another log file from a recording attempt where the video loop glitch happens? The log file you posted is just 1 minute long, with nothing reported that relates to any sort of media loading fail.

I do notice that you're using .mov files... are these by chance the ones that have the issue of not looping? Also, have you updated VLC recently?

As a side note... that 2600k is an absolute trooper for running everything you're asking it to.
 
Last edited:

ayawnimouse

New Member
Thanks for responding! Yeah I've had this processor for a really long time and its a monster - I've seen no reason to upgrade it yet.

All the media files that are glitching are MOV files. I could convert them to something else, do you have a suggestion of a format that is 'safer'? I downloaded a bunch of royalty free looping backgrounds that I put behind my avatar when I stream. Depending on if I do poorly or great, or need to Brb or end the stream, each scene has a different looping background video, most of them are really short/small files. I'm not sure how OBS handles files, but it seems like since you can copy and paste 'references' to media, that its like a single file open even if I switch between scenes quickly (or at least I hope so) I'm actually really impressed with what I can do real time, especially if I didn't run into these bugs!

So I figured out a way around it that I do not like but doesn't seem to crash OBS (the switching collections over and over does cause it to crash and I don't have a monitoring monitor while I'm livestreaming right now so I don't even realize it crashed until I'm done with the stream!) So the way around it is to upload the video to a website, and set it up as a non local file. It reloads it everytime I switch to the scene (with a delay) - but in web fetched videos apparently you can't loop them (boooo). Some of them I auto switch back to game after a short delay so thats ok, but long term I need something that will loop, or I'll have to make a video of it looping for a hour or something so that I don't have to worry about OBS not looping it. The only other issue with the web fetched file is it leaves the last frame up or black (seems like its random), so I took a screenshot of it and added the screenshot as the source so that when it switches to that scene the screenshot comes through while its loading the video. Its a really crappy work around. That video though hasn't froze permanently yet at least. I'll load up the OBS again from scratch and swap around scenes until I can get it to freeze a video and upload a new log file.
 

ayawnimouse

New Member
I converted all my MOV's to MP4's and I'm still running into the same issue! (boo) Here is the log:
https://obsproject.com/logs/wnU3olvKR3ih9qKy

Error (I think):
MP: av_read_frame failed: Immediate exit requested (-1414092869)

Next Log:
https://obsproject.com/logs/Dx1n3HXvD9uKgMdS
Same Error, I tried increasing speed of videos to 101% hoping it would change parameters for the encoder. Still freezing

Just for good measure here is my ffmpeg info:
>ffmpeg -version

ffmpeg version N-93466-g681957b88d Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20190212
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 47.105 / 58. 47.105
libavformat 58. 26.101 / 58. 26.101
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100


I have updated my ffmpeg to the latest version and I'll update this thread if its fixed now:
>ffmpeg -version

ffmpeg version git-2019-11-22-27c6c92 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.2.1 (GCC) 20191010
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 36.100 / 56. 36.100
libavcodec 58. 62.100 / 58. 62.100
libavformat 58. 35.100 / 58. 35.100
libavdevice 58. 9.101 / 58. 9.101
libavfilter 7. 66.100 / 7. 66.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100

Does OBS have its own built in ffmpeg or does it use path etc to get at it on windows? I checked my last crash report and ffmpeg is mentioned here as a dll:
C:\Program Files\obs-studio\obs-plugins\64bit\obs-ffmpeg.dll
obs-ffmpeg.dll!mp_media_thread+0x7c
obs-ffmpeg.dll!mp_media_thread_start+0xe

Going to try to get it to freeze again while (hopefully) using the new version of ffmpeg, but I'm not sure how to check what version is being used inside of OBS.

Update: still freezing with updated ffmpeg if its using what I updated it to at least, here is the new log:
https://obsproject.com/logs/zK1xZNFUAG6qWUi2
same error as previous errors....

I'm going to try mkv files now....

EDIT 18,000,000:
I decided to try loading the mp4's inside of the VLC Video Source and just add the single file with looping the playlist. I actually like this better because I can have multiple potential backgrounds for each type of scene (like fire behind avatar when angry but sometimes make it something else). I've tried pretty hard to get it to crash the videos and so far it hasn't frozen. Some of them leave the last frame some times but it resets and starts the video over which is what I want, so for now this is my best fix given the bug from this thread. Thank you for your patience with my long post and I hope someone else tries this as a fix as google does seem to show other people having the same issue.
 
Last edited:

carlmmii

Active Member
As far as I know, for media playback OBS just uses VLC to do all decoding processes, so whatever pleases VLC the best would be your safest option. From personal experience, I've had the best luck re-encoding everything with ffmpeg into .mkv using x264 (specifically, I use FFmpegYAG with standard preset settings other than bitrate, but you can use anything you want).... and it looks like you've stumbled onto the same solution all by yourself!

I would specifically avoid ever using .mp4 or .mov for your videos, because of this:
Code:
15:23:36.032: error:   moov atom not found
Both of these formats have specific metadata that's required for playback that exists at the end of the file, so if there's any failure in reading (or if the file didn't get saved in its entirety), then there's no real way to play it back, since it's not a stream-oriented storage container. That is also why for OBS recording the recommendation is to avoid these containers entirely (and there's even a warning on the recording page stating this).

.mkv all the things.
 

ayawnimouse

New Member
wow thank you for responding with helpful info! I'll reencode everything I use as a video as mkv. I switched my recording video output to mkv for the reason you mentioned in terms of the warning that says if the program crashes while recording a non mkv the resultant video will not be playable, I didn't understand why but now I do. Thank you. Yeah the method I'm using is using the vlc media source instead of just a 'media source' which I think was my problem or at least the reason the error freezing is linked to. I found a couple google results for the error related to ffmpeg encoding, so I was thinking maybe obs uses that real time to build the scene with all the chroma calculations etc, and if it runs into an error importing the video in question it doesn't try to fix it, it just sort of ignores it and moves on, which i think is a bug, since you can restart the video by going into properties of it and hitting ok... but you can't restart it with the keyboard shortcut that is supposed to restart that media! I'm going to look into writing a plugin and see what kind of control you have with programming obs outside of the norm. Hopefully it gives you access to plugins and real restarting of media. I'm thinking it does as I have an auto running highlight replay that saves the last 25 seconds and then plays that new video in the scene and then hides it. I think it was just a lua script.

I'm sorry I ramble its how I think and I'm tired. Thanks again for your helpful response!
 

Mr.Cacio

New Member
Just wanted to thank carlmmii - had similar problems with .mp4s not looping (just st0pping when they got to the end) in my scenes. Tried reducing the quality/fps and the bit rate - still the same. Re-did them as .mkv files and they are now looping fine!
 
Top