Conversion fails when user is not logged in

I am having an issue when I remote in to my server then close the connection which logs me off. This make my conversions throw an error which it did not use to do. Can you help? Log with example is attached.

married.at.first.sight.s09e02.720p.web.h264-tbs.mkv-Move-TV-2019-06-20T22-20-14.5933286-05-00.log (354.9 KB)

You’re using hardware encoding and your graphics driver is the problem, it’s throwing an error:

2019-06-20T22:21:59 MCEBuddy.AppWrapper.FFmpeg --> [AVHWDeviceContext @ 000001d98ef0a6c0] Failed to create Direct3D device
2019-06-20T22:21:59 MCEBuddy.AppWrapper.FFmpeg --> Device creation failed: -1313558101.

If it was working until recently then it sounds like your graphics driver was updated and now it needs you logged into the system for it to work.

2019-06-20T22:21:58 MCEBuddy.AppWrapper.FFmpeg --> Starting process as a UISession process with Admin privileges. This requires atleast 1 user to be logged into the system (remote desktop or locally)
ERROR> 2019-06-20T22:21:58 --> StartAppWithAdminPrivilegesFromNonUISession WTSQueryUserToken failed (No logged on users) with error 1008. An attempt was made to reference a token that does not exist.
WARNING> 2019-06-20T22:21:58 MCEBuddy.AppWrapper.FFmpeg --> Unable to create UI Session process with Admin Privileges from NonUI Session. Is any user logged on?
WARNING> 2019-06-20T22:21:58 MCEBuddy.AppWrapper.FFmpeg --> Retrying process creation as a NonUI Session process with Admin privileges
WARNING> 2019-06-20T22:21:58 MCEBuddy.AppWrapper.FFmpeg --> Some functions like hardware encoding may not work in this mode

It’s not related to MCEBuddy but an error from Windows related to your graphics driver.

Since you’re using a custom profile and have explicitly disabled software encoder fallback in your profile, it won’t try to use the software encoder when your hardware encoder fails:

ffmpeg-UsingHardwareEncoding=True

Did the embedded version of FFMpeg get updated? I recall getting errors like this when I was experimenting with replacing the included version with the latest builds. FWIW, I’m getting the same error after updating to 2.4.11. My video drivers have not been updated for some time…

Log: https://1drv.ms/u/s!AipRNNbyPsCgn78-Hk1lFPMQJNtnRQ?e=eZLHXG

I see the exact same error in your logs. Is there any user logged into the computer?
I suspect the ffmpeg hardware API is different from handbrake and needs a user logged into the system for it to work.
Handbrake hardware API seem to work without any logged in users starting Windows 8.1, I suspect this is not true with ffmpeg.

Can you try with a user logged in and see if it works?

It works fine with user logged in

1 Like

There is a user logged in, but I remote into that box, which when I disconnect, I think makes it look like I’m logged out.

It works great when I’m logged in.

I think I’ve already done the work to get Handbrake set up, however:
[MKV HVEC Beta Profile Constant Quality]
Description=WARNING: Handbrake Constant Quality encoding (26) with Nvidia HVEC.
order=ffmpeg, handbrake
AllowH264CopyRemuxing=true
FixedResolution=true
AutoDeinterlace=true
ffmpeg-UsingHardwareEncoding=True
ffmpeg-general=-threads 0 -hwaccel auto
ffmpeg-video=-ss 9 -c:v hevc_nvenc -cq 26 -rc vbr -map 0:v
ffmpeg-audio=-acodec ac3 -ab 192k -map 0:a
ffmpeg-audioac3=-acodec ac3 -ab 384k -map 0:a
ffmpeg-ext=.mkv
ffmpeg-audiodelay=skip
handbrake-UsingHardwareEncoding=true
handbrake-general=–decomb --denoise=“weak” --loose-anamorphic --verbose=2 -T -O
handbrake-video=–start-at duration:0 --encoder nvenc_h265 --encoder-preset slow --quality 26 --vfr
handbrake-audio=-E ffac3 -R auto -B 192 -D 0 -a 1,2,3,4,5
handbrake-audioac3=-E ffac3 -R auto -B 384 -D 0 -a 1,2,3,4,5
handbrake-ext=.mkv
handbrake-audiodelay=skip

Isn’t Handbrake already set up for NVENC HEVC?

Thanks! Will.

1 Like

Which OS are you running? For handbrake, we know that Windows XP-7 requires an active terminal where as Windows 8-10 it works even without an active terminal.

FFMPEG is a different ball game, it uses a different set of API’s which unfortunately require a user to be logged into Windows with an active terminal.

I won’t get into technical details but that’s essentially a Windows design issue as the kernel wasn’t originally designed to access hardware API’s. Microsoft has made improvements so Handbrake is able to work in kernel mode (MCEBuddy by default runs as a service in kernel mode) but FFMPEG API’s still require a logged in user with an active terminal. So if you’re using MCEBuddy and ffmpeg, ensure that a terminal is active and doesn’t log out. I believe RDP has an option to disconnect without logging out - I think that will work.

Yes but it isn’t as stable as ffmpeg so MCEBuddy doesn’t use it, but you can use it. YMMV. Let us know how it works out for you.

I’m running the current version of Windows 10 (1903). I’m logged into the machine currently via Remote Desktop and it seems to be running fine. I’m using a post processing batch file to invoke MCEBuddy from Plex.

Thanks! Will.

[HEVC MP4]
Description=WARNING: Handbrake Constant Quality encoding (26) with Nvidia HVEC.
order=ffmpeg, handbrake
AllowH264CopyRemuxing=true
FixedResolution=true
AutoDeinterlace=true
ffmpeg-UsingHardwareEncoding=True
ffmpeg-general=-threads 0 -hwaccel auto
ffmpeg-video=-ss 9 -c:v hevc_nvenc -cq 26 -rc vbr -map 0:v
ffmpeg-audio=-acodec ac3 -ab 192k -map 0:a
ffmpeg-audioac3=-acodec ac3 -ab 384k -map 0:a
ffmpeg-ext=.mp4
ffmpeg-audiodelay=skip
handbrake-UsingHardwareEncoding=true
handbrake-general=–decomb --denoise=“weak” --loose-anamorphic --verbose=2 -T -O
handbrake-video=–start-at duration:0 --encoder nvenc_h265 --encoder-preset slow --quality 26 --vfr
handbrake-audio=-E ffac3 -R auto -B 192 -D 0 -a 1,2,3,4,5
handbrake-audioac3=-E ffac3 -R auto -B 384 -D 0 -a 1,2,3,4,5
handbrake-ext=.mp4
handbrake-audiodelay=skip

It still is not working when I am not logged in. Any suggestions on the profile I am using above to make it work.

I’m still getting failures, despite being logged in. I’m going to try replacing FFMpeg with the latest version from the site.

Here’s the logs from the latest failure: https://1drv.ms/u/s!AipRNNbyPsCgn79JAjj6AhxbcGNTSA?e=X5HSAb

According to Windows, there’s no logged in user, it can’t find a reference to logged in user:

StartAppWithAdminPrivilegesFromNonUISession WTSQueryUserToken failed (No logged on users) with error 1008. An attempt was made to reference a token that does not exist.

You can try this to ensure that a user is logged in. Start MCEBuddy as a command line engine from the Start Menu. This will shutdown the engine running as a service and instead start it as command line service from within the user. If the user logs out the service will stop.
Now as a logged in user, ffmpeg should have access to all the hardware API’s. That will confirm what’s going on.

Do note that there are reports that if you RDP into Windows, it doesn’t provide access to all hardware API’s. It’s best to login locally and then connect remotely to the same logged in user.

Really appreciate the help - will try that. Do you know if there’s a way to run the command line start from shell:startup without turning off UAC?

Thanks again! Will.

You could set Task Scheduler to start the command line engine at user login with the highest privileges.

Of course! I always forget about that. thank you!