obsproject / obs-amd-encoder

AMD Advanced Media Framework Encoder Plugin for Open Broadcaster Studio
https://obsproject.com/forum/threads/amd-advanced-media-framework-encoder-plugin-for-obs-studio.52305/
GNU General Public License v2.0
454 stars 87 forks source link

pre7 & 480 = memory leak? #72

Closed nwgat closed 8 years ago

nwgat commented 8 years ago

MSI Gaming X 480/ Catalyst 16.8.3 FX-8350, 32GB 1600mhz, 850 PRO SSD OBS 0.15.4 x64 on Windows 10 x64 AMF Plugin 1.3 Pre7 Simple mode: Recording preset (default settings)

2016-09-04 02-24-17.txt 2016-09-04 02-23-34.txt

sometimes it works, sometimes it doesn't, its random, i only notice it when the obs video hangs at either la st picture og black screen, when i try to stop it and it will still say "stopping recording" for a hundred years

PS: setting scan type to progressive seems to do the opposite aka making it interlaced

max20091 commented 8 years ago

uninstall AMF Plugin then reinstall again may help :D Interlaced will look like this: http://www.tvjuneau.com/images/InterlacedVsProgressive.jpg

Xaymar commented 8 years ago

I can't reproduce this here, there is absolutely nothing that can leak. Your encoder was most likely stuck, in which case yell at @jp9000 to just call the destroy for encoders no matter what (jk, please don't yell at Jim).

Another thing that could have happened is that the plugins threads got stuck - there is currently no standard way of killing these threads so it'll just stay there, waiting forever.

PS: setting scan type to progressive seems to do the opposite aka making it interlaced

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L4.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Original frame rate                      : 60.000 FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
DURATION                                 : 00:06:31.017000000

I don't see that happening here.

nwgat commented 8 years ago

obs still hangs with last frame even with pre8 and it still says "stopping.." when stopping it 2016-09-06 16-00-13.txt 2016-09-06 15-55-43.txt

i noticed this 16:01:26.795: [AMF Encoder] <Plugin::AMD::VCEEncoder::SendInput> Input Queue is full, aborting...

locodicegr commented 8 years ago

''I only notice it when the obs video hangs at either last picture og black screen, when i try to stop it and it will still say "stopping recording" for a hundred years''

Both issues i have them...you describe them better than me lol...but yea its very random!!

Sometimes it works , sometimes it doesnt, maybe its a driver issue..i really dont know whats happening.

I wish we had a shadowplay.

nwgat commented 8 years ago

@locodicegr your specs?

locodicegr commented 8 years ago

@nwgat Here you go:

CPU:i5 750 Cooler:Corsair A50 M/b:Asus P7P55-M Ram:HyperX 8GB GPU:Gigabyte R9 380 4G SSD:Kingston v300 HDD:WD BLUE 1TB Soundcard:SB-Z Case:Corsair Air 540 PSU:XFX TS 550w

Im gonna do a clean format of windows soon, to re-test it. Maybe i will catch up a newer version.

Xaymar commented 8 years ago

The issue is that OBS doesn't properly quit the encoder until a keyframe is returned. But I have no way to do that - even with my fail safe it still hangs occasionally.

Xaymar commented 8 years ago

1.3.0pre8 includes an experimental emergency quit now, it should hopefully "solve" this issue. I'm closing this anyway as the issue is with OBS not quitting properly until a keyframe is received.

nwgat commented 8 years ago

its actually two issues thats related

Issue 1 frame get stuck after a around ~40 seconds, so the encoder is not working correctly (rise of tomb raider benchmark is a good test case for me, it stops every time), i suspect it might have something to do with a buffer in amf thats not transferred out before its full

update: did some desktop recording (video playback) and the issue is not there, even stop button works, so its hitting some kind of buffer limit while gaming but not desktop or light games (like hl2 lost coast benchmark)

issue 2 pressing stop will not stop it (obs issue but related)

nwgat commented 8 years ago

more logs 2016-09-07 07-29-04.txt 2016-09-07 07-28-13.txt

Xaymar commented 8 years ago

I don't see it getting stuck in the log files, it's happily encoding there. It's behind by 4 frames, but that is normal encoding delay.

Xaymar commented 8 years ago

If the issue is that the Input Queue slowly fills up, that is because your settings are too much for your card to handle. Your output file will show this too, so make sure to not go batshit insane with the settings - keep it simple, not everything that can be touched needs to be touched.

If you want to see this fixed, the issue tracker for the AMF SDK is here: https://github.com/GPUOpen-LibrariesAndSDKs/AMF/issues . The plugin is only an interface on top of the SDK so that it can be used with OBS. I didn't make the encoder, AMD did.

nwgat commented 8 years ago

using the recording preset in simple is batsane crazy on a 480?, hey locodicegr what game are you capturing? i bet its a newer one, can you try half-life 2 lost coast benchmark?

nwgat commented 8 years ago

another log from simple recording preset 2016-09-07 08-12-48.txt

nwgat commented 8 years ago

Running Rise of the Tomb Raider at High instead of Very High made encoding work a note about "game's graphical settings might effect encoding performance" would have been useful

running rise of tomb raider at very high and all maxed out nosedives encoding performance

locodicegr commented 8 years ago

@nwgat just tried BF1 beta with pre7 / 16.8.3 / recording / simple /

all good no problems!

Xaymar commented 8 years ago

@nwgat

using the recording preset in simple is batsane crazy on a 480?, hey locodicegr what game are you capturing? i bet its a newer one, can you try half-life 2 lost coast benchmark?

Only your first, second and last log file are from the Simple Interface, the other one is from the Advanced Interface. And in the one file where it did run into an error, it quit the encoder just fine - it is OBS that didn't display this happening.

Running Rise of the Tomb Raider at High instead of Very High made encoding work a note about "game's graphical settings might effect encoding performance" would have been useful

I'm not sure what you expected. It's a GPU encoder, it uses the GPU (and some parts of the CPU). If your GPU is too busy doing whatever, then it can't do the encoding - or at least not the parts that would be necessary for submission and querying. This is especially true for DirectX12 and Vulkan games, which will take full control of the hardware and can push themselves to be higher priority than encoding. I'm not sure how to solve this.

nwgat commented 8 years ago

was thinking of a dedicated hw block in the die, but if it also uses the gpu amd might want to add in some feature that guarantee amf/vce high priority i dont mind having 6-10 less frames in game to get a smooth encoding

Xaymar commented 8 years ago

Yeah, the dedicated HW block handles the actual encoding (still takes some bandwidth off of the GPU). But there's also the color transcoding it does which can't be disabled - in fact even if you convert it yourself before it will do it again. It'd be great if AMD added a lot of features to get it back up to speed with Media SDK which supported assigning Encoding Priority.

nwgat commented 8 years ago

when Encoding Priority, HEVC and 2-Pass is enabled at AMD's AMF side, Your plugin will the superior method, even now it runs circles around MF/old plugins