ffmpeg-mux no longer silently ignoring errors
Platform
Operating system and version: MacOS 10.15.6 OBS Studio version: 26.0.2
Current Behavior
Upon stating a recording, error window appears with "An encoder error occurred while recording". This stops recording, leaving a file with just a few recorded frames in it. This started immediately after upgrading to 26.0.2.
Steps to Reproduce
- Open OBS
- Set up minimal scene with audio/visual input
- Record
- Error
Additional information
Going into Settings > Output in an attempt to check/change settings, shows that all the options are greyed out. Nothing can be changed other than the bitrate, see image
Going into Settings > Video gives an intriguing message of "Video output is currently active. Please turn off any outputs to change video settings". I'm not precisely sure what this means or how to turn off video output... Nothing had changed in my workflow or setup before the bug started.
Attempted to downgrade, but noted that executables are only available for the latest version.
EDIT: Log file now attached 2020-10-09 12-25-20.txt
As per your log file, the active output is the NDI broadcast
12:25:21.349: [obs-ndi] starting NDI main output with name 'OBS'
12:25:21.350: [obs-ndi] 'OBS': ndi output started
Otherwise this is a duplicate of #3572
Please use the discord or the forums for support.
Narrowed down the problem to Apple VT H264 Hardware Encoding as the encoder that causes the error. happy to use the forums, but what's the boundary between a software bug and support? It worked in the previous version, so felt like it was a bug.
@drbenvincent Could you please check if the problem persists when changing to a different output folder? Also change the output container to mkv and try recording with that?
can you try recording in flv? mp4 is never a wise choice actually as spelt out in the orange warning
and also give us your hardware specs (macbook, imac, version ...)
Hardware encoding + different folder + mp4 (as before)leads to same error. Hardware encoding + different folder + mkv leads to same error. Hardware encoding + different folder + flv leads to same error
Recording with x268 works fine. Recording with software H264 works, but seems to be terrible despite the same bitrate (maybe that's irrelevant).
Specs: iMac 2019 retina 5k. 8 core i9. 40Gb Radeon Pro 580X 8Gb
in 25.0.8 it worked fine ? you have an error only on 26.0.2 ?
Yes, it's been working fine - I've been recording for about a month so I believe that covers 25.0.8 and 26.0. Opened up to record today, did the autoupdate (from 26.0 I believe to 26.0.2) and all of a sudden the error started. No change in settings, OS update, hardware, etc.
You can still download 26.0 from our releases page here on Github - can you just download and run OBS from the disk image (it should pick up your current setup just fine) and try with that version?
You can still download 26.0 from our releases page here on Github - can you just download and run OBS from the disk image (it should pick up your current setup just fine) and try with that version?
I tried that first of all, but it looks like it's just the source code available? https://github.com/obsproject/obs-studio/releases/tag/26.0.0 Sorry if I'm not looking in the right place.
Huh, try the build from our CI: https://github.com/obsproject/obs-studio/actions/runs/276555583
The one ending with -rel in the filename is the notarised release version.
Due to #3460 ffmpeg errors are now being handled and cause ffmpeg-mux to be aborted instead of silently ignoring the errors.
There may be some transient error cases that need to be handled in ffmpeg-mux that are not handled.
@Eric The errors reported in the logs seem to be emitted by the write_packet function when the return value of ret = os_process_pipe_write(stream->pipe, packet->data, packet->size); doesn't equal the packet size (either because less bytes were written or an error occurred and thus 0 is returned).
I haven't dug into ffmpeg-mux enough to rule this out, but that doesn't look like an area that your PR touched?
@drbenvincent Could you please try again with a recent macOS build? https://github.com/obsproject/obs-studio/actions/runs/310675931
@PatTheMav The thing that changed is that previously if there was a problem in the ffmpeg encoder in the mux process, it would silently ignore the error and continue. Now, with the change, it will see the error and exit the process. That could cause the os_process_pipe_write for packet data failed message. On Windows, the pipe process captures stderr (on POSIX you will just see the ffmpeg logs in the log).
So, there are a few possibilities:
- There was a transient error that happens when calling
av_interleaved_write_frame()in ffmpeg-mux that does not prevent the process from otherwise working that is now causing ffmpeg-mux to exit and print that message - Something is for some reason isn't being printed in the logs by
signal_failure() stderrisn't being read fromffmpeg-muxuntil the process exits and it could be causing issues with the buffer of the child process getting full
Several similar reports, I've updated the title of this PR and going to close the others and direct them here for further discussion.
Try changing the "Common FPS values" in settings -> video section to something different to 29.97 or 59.94. Thats work form me. No error while recording using "use stream coder" and the Apple VT h264 Hardware Encoder.
I've reverted the line causing problems for now in https://github.com/obsproject/obs-studio/commit/ffe4c8552bb25a2e4ac8b88e60b6f3ac1784a7f8.
I've reverted the line causing problems for now in ffe4c85.
The revert above has been reverted by https://github.com/obsproject/obs-studio/commit/17b38735786f019cea64b03ed0659fcefa16ebaf with additional fixes. Can those affected by this issue please try the current builds? @drbenvincent
https://github.com/obsproject/obs-studio/actions/runs/371349643
The fixes I mentioned above are also included in OBS Studio 26.1 RC1. If someone previously affected could test RC1 and report back, that'd be great. Thanks! @drbenvincent