obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

ffmpeg-mux no longer silently ignoring errors

Open drbenvincent opened this issue 6 years ago • 32 comments

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

  1. Open OBS
  2. Set up minimal scene with audio/visual input
  3. Record
  4. 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 Screenshot 2020-10-09 at 13 17 00 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. Screenshot 2020-10-09 at 13 17 47 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

drbenvincent avatar Oct 09 '20 12:10 drbenvincent

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.

Scrxtchy avatar Oct 09 '20 12:10 Scrxtchy

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 avatar Oct 09 '20 12:10 drbenvincent

@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?

PatTheMav avatar Oct 09 '20 15:10 PatTheMav

can you try recording in flv? mp4 is never a wise choice actually as spelt out in the orange warning

pkviet avatar Oct 09 '20 15:10 pkviet

and also give us your hardware specs (macbook, imac, version ...)

pkviet avatar Oct 09 '20 15:10 pkviet

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

drbenvincent avatar Oct 09 '20 15:10 drbenvincent

in 25.0.8 it worked fine ? you have an error only on 26.0.2 ?

pkviet avatar Oct 09 '20 16:10 pkviet

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.

drbenvincent avatar Oct 09 '20 16:10 drbenvincent

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?

PatTheMav avatar Oct 09 '20 16:10 PatTheMav

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.

drbenvincent avatar Oct 09 '20 16:10 drbenvincent

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.

PatTheMav avatar Oct 09 '20 16:10 PatTheMav

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 avatar Oct 10 '20 20:10 eric

@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?

PatTheMav avatar Oct 16 '20 19:10 PatTheMav

@drbenvincent Could you please try again with a recent macOS build? https://github.com/obsproject/obs-studio/actions/runs/310675931

RytoEX avatar Oct 16 '20 21:10 RytoEX

@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:

  1. 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
  2. Something is for some reason isn't being printed in the logs by signal_failure()
  3. stderr isn't being read from ffmpeg-mux until the process exits and it could be causing issues with the buffer of the child process getting full

eric avatar Oct 17 '20 04:10 eric

Several similar reports, I've updated the title of this PR and going to close the others and direct them here for further discussion.

Fenrirthviti avatar Oct 18 '20 22:10 Fenrirthviti

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.

jedidiah-yanez avatar Oct 19 '20 15:10 jedidiah-yanez

I've reverted the line causing problems for now in https://github.com/obsproject/obs-studio/commit/ffe4c8552bb25a2e4ac8b88e60b6f3ac1784a7f8.

jp9000 avatar Nov 14 '20 21:11 jp9000

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

RytoEX avatar Nov 20 '20 23:11 RytoEX

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

RytoEX avatar Dec 01 '20 08:12 RytoEX