nicknsy / jellyscrub

Smooth mouse-over video scrubbing previews for Jellyfin.
MIT License
668 stars 27 forks source link

Error while creating BIF file. Unable to set process priority. #86

Closed OSS-GR closed 1 year ago

OSS-GR commented 1 year ago

My Jellyfin logs are filled with the following error for a lot of my content:

[2023-02-21 23:09:01.350 -05:00] [INF] [28] Nick.Plugin.Jellyscrub.Drawing.VideoProcessor: Creating trickplay files at 320 width, for "/mnt/manshare/Jellyfin/Movies/Wreck It Ralph/Wreck-It Ralph (2012) Bluray-1080px264 AAC.mp4" [ID: e6e77404-bc2f-fea6-7025-2d4d940c0211]
[2023-02-21 23:09:01.350 -05:00] [INF] [28] Nick.Plugin.Jellyscrub.Drawing.OldMediaEncoder: /usr/lib/jellyfin-ffmpeg/ffmpeg -loglevel error -init_hw_device vaapi=va:/dev/dri/renderD128 -filter_hw_device va -hwaccel vaapi -hwaccel_output_format vaapi -autorotate 0 -i file:"/mnt/manshare/Jellyfin/Movies/Wreck It Ralph/Wreck-It Ralph (2012) Bluray-1080px264 AAC.mp4" -autoscale 0 -an -sn -vf "fps=1/10,setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale_vaapi=w=320:h=134:format=nv12" -threads 0 -c:v mjpeg_vaapi -f image2 "/var/cache/jellyfin/temp/dbb20ce1c6894ada849a3cfc465ba9bd/img_%08d.jpg"
[2023-02-21 23:09:01.351 -05:00] [INF] [28] Nick.Plugin.Jellyscrub.Drawing.OldMediaEncoder: Setting generation process priority to AboveNormal
[2023-02-21 23:09:01.351 -05:00] [ERR] [28] Nick.Plugin.Jellyscrub.Drawing.OldMediaEncoder: Unable to set process priority: "Permission denied" (will not prevent BIF generation!)
[2023-02-21 23:09:01.546 -05:00] [INF] [13] Jellyfin.Plugin.PlaybackReporting.EventMonitorEntryPoint: Processing playback tracker : "TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzEwOC4wLjAuMCBTYWZhcmkvNTM3LjM2IEVkZy8xMDguMC4xNDYyLjU0fDE2NzI3NTkyMzQ2NDc1-7f2c574c0ee14f479c8b41e8e1a795e1-392285dc052cdf93ea7fb5671d9fd329"
[2023-02-21 23:09:01.735 -05:00] [ERR] [28] Nick.Plugin.Jellyscrub.Drawing.VideoProcessor: Error while creating BIF file
System.InvalidOperationException: Cannot make BIF file from 0 images.
   at Nick.Plugin.Jellyscrub.Drawing.VideoProcessor.CreateBif(String path, Int32 width, Int32 interval, BaseItem item, MediaSourceInfo mediaSource, CancellationToken cancellationToken)
   at Nick.Plugin.Jellyscrub.Drawing.VideoProcessor.Run(BaseItem item, MediaSourceInfo mediaSource, Int32 width, Int32 interval, CancellationToken cancellationToken)

I have generated some .bif files for other movies or shows in the past but I am not sure why this is happening now. I am not sure what additional information you might need to look into this, so do let me know.

nicknsy commented 1 year ago

Well the "unable to set process priority" is fine. At least on linux, anything above normal seems requires elevated permissions and it will just default to normal priority on error.

"Cannot make BIF file from 0 images" is bad because it means ffmpeg exited without generating any images, but ffmpeg didn't output any errors so I'm not sure whats going on there. You say you have generated some in the past--was it working fine and just errored on this one movie? Was it working a couple weeks ago until you updated it? Did it stop working after you changed anything like hardware acceleration settings?

OSS-GR commented 1 year ago

I used to have it working with HWA set to "None" without realizing but that was super stressing on the CPU so I changed it to Full. I am not sure if the error started happening after I switched to Full HWA or updating to 1.0.0.9. I will try downgrading the version and test again. EDIT: Error happens on a lot of my movies not just this one. I am using an AMD RX 590 with VAAPI for HWA.

nicknsy commented 1 year ago

AMD does not support mjpeg encoding, so if you set it to "No Encode" it should start working. That's my bad since when I initially wrote the description about "on older hardware set to No Encode..." I didn't realize that all AMD hardware didn't support mjpeg encoding at all through vaapi.

OSS-GR commented 1 year ago

Okay let me try that.

nicknsy commented 1 year ago

Whats weird is that you had no error from ffmpeg, as when I tried with an AMD graphics card I got an error about no suitable encoding profiles.

OSS-GR commented 1 year ago

If I run the command mentioned in the logs straight through my terminal, I get the following: [mjpeg_vaapi @ 0x56268664e8c0] No usable encoding entrypoint found for profile VAProfileJPEGBaseline (12). Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Not sure why it is not in the logs.

Changing the setting to "No Encode" seems to have fixed it. This is the log from the first bif file it created.

[2023-02-22 00:03:00.983 -05:00] [INF] [23] Nick.Plugin.Jellyscrub.Drawing.VideoProcessor: Finished creation of trickplay file "/mnt/manshare/Jellyfin/Movies/22 Jump Street (2014) [1080p]/trickplay/22 Jump Street (2014) Bluray-1080px264 AAC-320.bif" [2023-02-22 00:03:01.004 -05:00] [INF] [13] Nick.Plugin.Jellyscrub.Drawing.VideoProcessor: Creating trickplay files at 320 width, for "/mnt/manshare/Jellyfin/Movies/Aftermath (2017) [1080p] [YTS.AG]/Aftermath (2017) Bluray-1080px264 AAC.mp4" [ID: 818f5dcd-7b95-4f4b-387f-f39ae7fcaf0d] [2023-02-22 00:03:01.004 -05:00] [INF] [13] Nick.Plugin.Jellyscrub.Drawing.OldMediaEncoder: /usr/lib/jellyfin-ffmpeg/ffmpeg -loglevel error -init_hw_device vaapi=va:/dev/dri/renderD128 -filter_hw_device va -hwaccel vaapi -hwaccel_output_format vaapi -autorotate 0 -i file:"/mnt/manshare/Jellyfin/Movies/Aftermath (2017) [1080p] [YTS.AG]/Aftermath (2017) Bluray-1080px264 AAC.mp4" -autoscale 0 -an -sn -vf "fps=1/10,setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scalevaapi=w=320:h=132:format=nv12,hwmap,format=nv12" -threads 0 -c:v mjpeg -f image2 "/var/cache/jellyfin/temp/c49734f8e78d4d84ba4a4bfbec65271f/img%08d.jpg" [2023-02-22 00:03:01.005 -05:00] [INF] [13] Nick.Plugin.Jellyscrub.Drawing.OldMediaEncoder: Setting generation process priority to AboveNormal [2023-02-22 00:03:01.005 -05:00] [ERR] [13] Nick.Plugin.Jellyscrub.Drawing.OldMediaEncoder: Unable to set process priority: "Permission denied" (will not prevent BIF generation!)

nicknsy commented 1 year ago

Glad that solved it for you. I'll have to look into why it's not logging errors though.