News:

--

Main Menu

Cut OBS x264 video becomes garbled

Started by phaolo, July 10, 2019, 08:50:18 AM

Previous topic - Next topic

phaolo

Hello, I noticed that when I cut OBS videos (directly, without re-encoding), the result becomes broken.
I just get a grey garbled image in VLC.

Example videos (Enter the Gungeon shop):
https://drive.google.com/file/d/1Ud4yCLwVOCJ0i5cR6iFgwhopzBJqkDv8/view?usp=sharing
https://drive.google.com/file/d/118Su4EAYeSW6fCxJA9L1q2eu0y7O1L0p/view?usp=sharing

I see this in VLC:
https://drive.google.com/file/d/1VF2zJsRPMDfA6YKgEUOJz8AZDTtsw-oC/view?usp=sharing

Do you know why?

P.s: and re-encoding to H265 sometimes works, but other times I get a video with freezing frames

eumagga0x2a

Thank you for the sample. mpv complains

[mkv] This is a broken file! Packets with incorrect keyframe flag found. Enabling workaround.

when playing the source video.

I'll look into this later. Probably the file is really broken, but it would be interesting to investigate whether we could deal with it better.


eumagga0x2a

The H.264 video stream in the sample is indeed broken in the following way: it doesn't contain proper IDR (instant decoder refresh) frames except of the very first frame but uses recovery, i.e. some non-IDR frames (P-frames) are encoded in a way which allows forward decoding to succeed when initiated at these frames. For this purpose, these frames must be announced in a preceding NAL (network abstraction layer) unit of type SEI (supplemental enhancement information) as recovery points. These SEI units are absent in the sample. Instead, non-IDR recovery frames are marked as IDR at the NAL layer, profoundly confusing decoders – at least in case of libavcodec at heart of VLC, mpv and Avidemux.

Freezing frames when re-encoded are probably the result of problems during the decoding phase, e.g. when a recovery frame is somewhat damaged and the decoder has to wait until the next recovery point passes by.

phaolo

#3
Thank you for replying.
Then this seems an OBS problem.
Tomorrow I'll write to the devs and point to this thread.

Btw, can these files be repaired in a non-destructive way? :\

eumagga0x2a

Quote from: phaolo on July 12, 2019, 01:06:23 AM
Btw, can these files be repaired in a non-destructive way? :\

Probably yes. It might be possible to inject a SEI NAL unit of the recovery type before each recovery point. I'll look into available options later.

phaolo

#5
Thank you. I really hope it will be possible.

In the meantime, OBS devs are checking this issue too.
Changing the color to NV12 instead of I444 seems to avoid the error, even if it's not really a solution for me.

eumagga0x2a

Quote from: phaolo on July 16, 2019, 10:33:02 PM
Changing the color to NV12 instead of I444 seems to avoid the error, even if it's not really a solution for me.

Could you please provide a short sample in NV12 colorspace which works?

phaolo

I can't! The forum program blocks me when I add the Google Drive link :/

An Error Has Occurred!
CleanTalk: *** Forbidden. Please enable JavaScript. ***

eumagga0x2a

CleanTalk is a disaster, topped only by the disaster without CleanTalk. Please provide the link per PM.

eumagga0x2a

Thank you for the sample. The video stream is indeed fully okay. It is yuv420p, not nv12. What did you mean by "changing color to NV12"?

phaolo

Quote from: eumagga0x2a on July 18, 2019, 01:10:47 PM
Thank you for the sample. The video stream is indeed fully okay. It is yuv420p, not nv12. What did you mean by "changing color to NV12"?
OBS has these color options:

format:
- NV12 (default)
- I420
- I444 (what I prefer)
- RGB

space:
- 601 (default)
- 709 (what I use)

range:
- partial (default)
- full (what I use)

The broken samples were obtained with I444, 709, full.
The last correct one, instead, with NV12, 601, partial.

I don't know why it's wrong.

Btw I'm just a normal user, ideally you devs should talk directly ;P
Here is the thread, in case you're interested to suggest something to OBS:
( CleanTalk stopped me again -_- )

eumagga0x2a

What happens if you strip the protocol prefix from links, making them unclickable?

I understand, you refered to OBS settings, not the real properties of the output.

phaolo

It doesn't work, I''l send you a PM.


phaolo

They finally replied again.
So, the culprit is the old x264 version they're using.. I hope they'll update it soon (not in years).

I'd prefer not to go back to those crappy NV12 or i420 colors as they suggested.
I'll keep using i444 and fix all the files with your method at some point in the future.
(I hope it will be also scriptable, because I made a ton of recordings)