Topaz's ffmpeg binary doesn't contain libx264 or libx265

I don’t know why they’re not there, because they are freely available, but those are my preferred encoders.
They can definitely give better quality than GPU based encoding.

I would normally encode with something like -c:v libx264 -crf 17 -preset slower -tune film

Since libx264 is not available, I would have to output as png images and then encode it myself with my own copy of ffmpeg.

Here is the answer from Developer,

2 Likes

Is there any chance someone can point me in the direction of learning how to do this? I’ve never compiled an app from source or anything like this

1 Like

Hi, I’m only a learner in terms of ffmpeg but it appears that one solution might be to pipe raw output from the TVAI ffmpeg into another ffmpeg which does have the libx264 encoder. An example is the free LosslessCut application which I can confirm does come with an ffmpeg that includes the libx264 encoder. Naturally, all this would require using the CLI but at least TVAI provides the original CLI command as a head start.

Thanks.

Andy

Update - I’ve just tried piping from TVAI’s ffmpeg to another downloaded ffmpeg built with libx264 and libx265 and it works! Just edit the TVAI export command by replacing everything after “-c:v” as in the following example for libx264.

ffmpeg … “-c:v” rawvideo -c:a copy -f: nut pipe:1 | /Users/Andy/Downloads/ffmpeg -i - -vcodec libx264 -acodec copy -vb 8000k -f: mp4 /Users/Andy/Desktop/pipeout.mp4

This was done on my Mac but the same principle should hopefully work for Windows.

Thanks.

Andy

3 Likes

Good stuff. :slight_smile: I already indicated you can use pipe:1 (in the other thread), but I’m glad you actually made it work. Personally, would have piped to x265 directly, but ffmpeg is just fine too, of course.

This may need some tweaking, though. x265 is incredibly CPU-heavy (as is TVAI). Recent threads suggested you can ‘starve’ TVAI for memory, to force it to start using GPU. That (if substantiated) could prove very beneficial, in that then the ffmpeg process can primarily use the GPU, and free the CPU for x265.

I will start doing some memory tests.

FYI: Alas, as @suraj said in Beta section: “In some cases especially for cards with lower vram, swapping from ram to vram happens a lot more leading to slow downs.” So, that’s a trick we can sadly forego.

Here is a pipe example. Let me know if you see any better way, but this is how I was able to use software x265 encoding directly.

I use this by first launching the Video AI GUI, then on the ‘Process’ menu, ''Open Command Prompt". In this way, the first ffmpeg call uses the ffmpeg that ships with Video AI, and the 2nd ffmpeg call is the one I manually installed at a different location on my PC which has other options available such as x265.

Example command:

ffmpeg “-hide_banner” -i “Z:/PathHere/YourVideo.mp4” “-flush_packets” “1” “-sws_flags” “spline+accurate_rnd+full_chroma_int” “-color_trc” “2” “-colorspace” “2” “-color_primaries” “2” “-filter_complex” “tvai_fi=model=chf-3:slowmo=1:rdt=-0.000001:fps=120:device=-2:vram=1:instances=0” -c:v huffyuv -pix_fmt yuv422p -c:a copy -f nut - | d:\ffmpeg\bin\ffmpeg -copyts -i - -c:v libx265 -preset slow -pix_fmt yuv420p10le -crf 25 “g:\YourVideo_New.mkv”

I just change out the options on the first call to ffmpeg, and update its filter complex, based on the copied ffmpeg command that I get from the Video AI GUI in the previews. You can specify multiple models to run at the same time in the filter complex if your workflow needs it. Again, just copy from the ffmpeg text in the Video AI GUI as an example.

Hope this helps someone! :slight_smile: