Log in

View Full Version : x265 only single threaded running in Wine on Linux


hello_hello
30th November 2023, 07:18
I thought I'd ask in case there's a fix for this problem. I'm running Avisynth in Wine (8.12) so I'm also using the Windows version of x265 (64 bit).
The problem is x265's log displays "no thread pools created", or something similar, and only wants to run in single threaded mode. The x264 encoder runs normally.

So I'm wondering if there's a way to fix this, or force x265 to use multiple threads in Wine?

Cheers.

Selur
30th November 2023, 20:15
Not a fix, but last time I used Avisynth through wine, I could use avs2yuv and pipe to a native encoder like x264, x265,.. so assuming this still works, there should be no need to use x265 through wine.

hello_hello
2nd December 2023, 08:27
Thanks. I'll give it a shot.

FranceBB
3rd December 2023, 02:41
Yeah either avs2yuv or FFMpeg and then it's a pipe to the Linux version of x264 and x265 and you're pretty much good to go.
Avisynth made some progress in the Linux direction, though, so perhaps, in let's say 10 years from now we're gonna have a set of filters working in the native Linux version (Fedora user here).

hello_hello
4th December 2023, 16:49
Would one of you guys be able to provide a sample command line for piping from ffmpeg to the native linux x265? I don't seem to be able to get it to work.

Cheers.

hello_hello
7th December 2023, 02:59
Well I worked out how to do it via the Terminal. For anyone else who might need help getting started and doesn't use the default Wine prefix, this is the command line I'm using for a 1080p encode:

WINEPREFIX="/home/UserName/.local/share/wineprefixes/Win64" wine "C:\\Encoders\\ffmpeg\\ffmpeg.exe" -i "M:\\SSD2\\xxx.avs" -strict -1 -f yuv4mpegpipe - | x265 --profile main10 --crf 20.0 --colorprim bt709 --transfer bt709 --colormatrix bt709 --sar 1:1 --output "/media/SSD2/xxx.hevc" --y4m -

What I'd really like to know if there's a way to pipe from Wine, from within Wine, if that makes sense. As x264 runs fine in Wine, everything works from within Wine and I can use AnotherGUI to create custom command lines and queue a bunch of scripts to encode. I don't know if there's a way to use the native linux version of x265 when encoding scripts that way though.

Selur
7th December 2023, 15:12
I doubt that you can start native Linux apps from within an app that is run by wine.

microchip8
7th December 2023, 17:15
Might as well go back to Windows...

hello_hello
10th December 2023, 03:16
I doubt that you can start native Linux apps from within an app that is run by wine.

I don't suppose you know if there's a Linux equivalent of AnotherGUI (https://www.videohelp.com/software/AnotherGUI)?
I've created AnotherGUI/x264 command line presets so I can open a bunch of Avisynth scripts and leave AnotherGUI to run them. It looks like I need to find a way to do something similar for the native Linux version of x265. I assume it's do-able using a bash script, but I'd have to learn how.

hello_hello
9th January 2024, 17:14
Well for anyone else who might need help doing it, this is my first attempt to get a form of batch encoding to work with Avisynth running in Wine and piping to the Linux x265 encoder. I still know stuff-all about writing bash scripts.
As best as I can tell batch encoding requires a bash script and a .desktop file to run it. The bash script needs to be marked as executable. If it's on the desktop there should be a right click option "Execute" to run the script directly, but running it via the desktop file will open it in a Terminal so you can see what's happening.

My desktop file is simply this. I've named it "x265 Encoding.desktop".
The blue text is the path to the bash script.

[Desktop Entry]
Name=x265 Encoding
Type=Application
Terminal=true
Exec="'/home/UserName/Desktop/x265 Encoding.sh'"

My bash script is called "x265 Encoding.sh". It'll encode any files in the specified folder with an avs extension. The output files will have the same names as the Avisynth scripts, but with a hevc extension. If an output file already exists, the encoding of the corresponding script is skipped rather than the output file being over-written. The scripts should be encoded in alphabetical order.

#! /bin/bash

while read filename; do
if [ -f "${filename%.avs}.hevc" ]
then
echo -e "\033[1;31mFile Already Exists:\033[1;33m ${filename%.avs}.hevc\033[1;39m"
else
WINEPREFIX="/home/UserName/.local/share/wineprefixes/Win64" wine "C:\\Encoders\\ffmpeg\\ffmpeg.exe" -i "${filename%}" -strict -1 -f yuv4mpegpipe - | x265 --crf 20.0 --profile main10 --preset slow --colorprim bt709 --transfer bt709 --colormatrix bt709 --output "${filename%.avs}.hevc" --y4m -
fi
done < <(find "/media/Drive2/Scripts/" -maxdepth 1 -type f -name '*.avs' | sort -t'/')

read -p "Press any key to exit" -rn1

Blue text: Path to the Wine prefix if it's not in the default location.
Green text: Path to the Windows version of ffmpeg in your Wine prefix.
Brown text: Path to the folder containing the Avisynth scripts.
Red text: "-maxdepth 1" prevents the bash script looking for Avisynth scripts to encode in sub-folders.

If anyone has better ideas for batch encoding Avisynth scripts on Linux, I'm open to suggestions.

StvG
9th January 2024, 17:31
Did you try running Avisynth natively (without wine)? If you're on Arch, AUR has a buch of the plugins packages (https://aur.archlinux.org/packages?O=0&SeB=nd&K=avisynth&outdated=&SB=p&SO=d&PP=50&submit=Go), otherwise you have to compile the plugins yourself. Some more info (https://github.com/AviSynth/AviSynthPlus/blob/master/distrib/docs/english/source/avisynthdoc/contributing/posix.rst).

hello_hello
10th January 2024, 11:23
Did you try running Avisynth natively (without wine)?

Not yet. Partly because Avisynth runs quite well in Wine, and partly due to the availability of plugins.

If you're on Arch, AUR has a buch of the plugins packages (https://aur.archlinux.org/packages?O=0&SeB=nd&K=avisynth&outdated=&SB=p&SO=d&PP=50&submit=Go), otherwise you have to compile the plugins yourself. Some more info (https://github.com/AviSynth/AviSynthPlus/blob/master/distrib/docs/english/source/avisynthdoc/contributing/posix.rst).

I'm not on Arch, but I'll check it out.

Cheers.