Page 1 of 1

Replace Command Executor for BITC & Watermarked H.264

Posted: Tue Feb 16, 2021 10:22 am
by MediaMogul
I'm migrating to a new workstation (Win 10) with the latest version of FFAStrans (1.1.0.0), but I'm having trouble setting up the command executor that I had working on the old workstation (Win7, FFAStrans v0.9.4.0). The command executor runs ffmpeg to create a h.264 proxy file with vertical blanking cropped off, burnt in timecode (custom font), watermark, audio mixdown mapping. Working parameters below.

D:\FFASTrans\ffmpeg.exe -i "%source%" -i "D:\FFASTrans\iconSmall30.png" -filter_complex "[0:v]crop=720:576:0:608, scale=1024:576, setsar=1[a];[a]yadif,scale=-2:576[b]; [b][1:v]overlay=main_w-overlay_w-30:main_h-overlay_h-15[c];[c]drawtext=fontfile=Open Sans-Regular.ttf: timecode='%i_stc_hh%\:%i_stc_mm%\:%i_stc_ss%\:%i_stc_ff%': r=25:x=(w-tw)/2: y=10: fontsize=45:fontcolor=white" -c:v libx264 -aspect 16:9 -crf 22 -maxrate 1404k -bufsize 3000k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -c:a aac -b:a 128k -ar 48000 -ac 2 -movflags +faststart -threads 0 -map 0:a? -metadata:s:a:1 language=eng -y "Q:\Proxies\%s_original_name%_proxy_16x9.mp4"

I've updated the file paths, checked them, and have tried using the previous working version of ffmpeg, but I keep getting an ffmpeg error code 1.

When I set this up, I settled with the command executor for ffmpeg because I couldn't get all of the custom parameters working with a Custom FFmpeg encoder processor. Any help would be appreciated.

Re: Replace Command Executor for BITC & Watermarked H.264

Posted: Tue Feb 16, 2021 11:31 am
by admin
Hi MediaMogul, thank you for using FFAStrans and welcome to the forum! :-)

Try replacing %source% with %s_source%. %source% is an outdated notation and no longer supported. However, your command should work just fine in a custom ffmpeg node:
-i "D:\FFASTrans\iconSmall30.png" -filter_complex "[0:v]crop=720:576:0:608, scale=1024:576, setsar=1[a];[a]yadif,scale=-2:576[b];[b][1:v]overlay=main_w-overlay_w-30:main_h-overlay_h-15[c];[c]drawtext=fontfile=Open Sans-Regular.ttf: timecode='%i_stc_hh%\:%i_stc_mm%\:%i_stc_ss%\:%i_stc_ff%': r=25:x=(w-tw)/2: y=10: fontsize=45:fontcolor=white" -c:v libx264 -aspect 16:9 -crf 22 -maxrate 1404k -bufsize 3000k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -c:a aac -b:a 128k -ar 48000 -ac 2 -movflags +faststart -threads 0 -map 0:a? -metadata:s:a:1 language=eng
Hope this helps.

-steinar

Re: Replace Command Executor for BITC & Watermarked H.264

Posted: Tue Feb 16, 2021 12:15 pm
by MediaMogul
advice from a 2017 post:

The first thing you need to make sure is that your ffmpeg command works from a dos command. Also, you must be aware one thing regarding the "Custom FFmpeg" encoder: You can NOT specify options before "-i". FFAStrans does this:

>>> indeed my code no longer runs from the command prompt.

ffmpeg.exe -i "%s_source%" <your command and options are inserted here> -y "output.<your extension>"

>>> looks like the input variable needs to be "%s_source%" now, not "%source%".

If you need to use options before the input "-i", like "-f h264 -i ...", then you must use the "Command executor"-node to create a completely custom ffmpeg command:

%comspec% /c ""%s_ffmpeg%" -f h264 -i "%s_source%" -c:v copy -fflags genpts "%s_original_path%\%s_original_name%.mkv""

This command will execute FFAStrans own ffmpeg executable and use the input delivered to the "Command executor"-node as the source. The ouput will be in the same folder with the same base name as the original source by utilizing the "%s_original_path%" and "%s_original_name%" variables. Be aware of the encapsulation quotes (")

>>> encapsulation quotes check, and also a clue to check if ffmpeg can find Win10 installed fonts.

Re: Replace Command Executor for BITC & Watermarked H.264

Posted: Mon Feb 22, 2021 8:38 am
by MediaMogul
I've made a little progress on this, but I'm still having trouble loading the correct font with FFASTrans.

My working ffmpeg test script (Watermark, Timecode, Correct Font etc OK). Run from a command prompt with all of the assets in the same directory:

ffmpeg.exe -i TestSD16x9.mov -i iconSmall30.png -filter_complex "[0:v]crop=720:576:0:608, scale=1024:576, setsar=1[a];[a]yadif,scale=-2:576[b]; [b][1:v]overlay=main_w-overlay_w-30:main_h-overlay_h-15[c];[c]drawtext=fontfile=OpenSans-Regular.ttf:\timecode='00\:00\:00\:00': r=25:x=(w-tw)/2: y=10: fontsize=45:fontcolor=white:borderw=1:bordercolor=DarkGray" -c:v libx264 -aspect 16:9 -crf 22 -maxrate 1404k -bufsize 3000k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -c:a aac -b:a 128k -ar 48000 -ac 2 -movflags +faststart -threads 0 -map 0:a? -metadata:s:a:1 language=eng -y D:\Proxies_OUT\Test_proxy_16x9.mp4

My Custom FFmpeg formatting:

-i iconSmall30.png -filter_complex "[0:v]crop=720:576:0:608, scale=1024:576, setsar=1[a];[a]yadif,scale=-2:576[b]; [b][1:v]overlay=main_w-overlay_w-30:main_h-overlay_h-15[c];[c]drawtext=fontfile=OpenSans-Regular.ttf:\timecode='%i_stc_hh%\:%i_stc_mm%\:%i_stc_ss%\:%i_stc_ff%': r=25:x=(w-tw)/2: y=10: fontsize=45:fontcolor=white:borderw=1:bordercolor=DarkGray" -c:v libx264 -aspect 16:9 -crf 22 -maxrate 1404k -bufsize 3000k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -c:a aac -b:a 128k -ar 48000 -ac 2 -movflags +faststart -threads 0 -map 0:a? -metadata:s:a:1 language=eng

Unfortunately returns this error: "Encoding: Option b:v (video bitrate (please use -b:v)) cannot be applied to input url iconSmall30.png -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to".

So does that mean that the second input for the watermark makes it too complex for a Custom FFmpeg processor?

My Custom Executor script:

D:\FFAStrans\Processors\ffmpeg\x64\ffmpeg.exe -i "%s_source%" -i D:\FFAStrans\Processors\ffmpeg\x64\iconSmall30.png -filter_complex "[0:v]crop=720:576:0:608, scale=1024:576, setsar=1[a];[a]yadif,scale=-2:576[b]; [b][1:v]overlay=main_w-overlay_w-30:main_h-overlay_h-15[c];[c]drawtext=fontfile=OpenSans-Regular.ttf:\timecode='%i_stc_hh%\:%i_stc_mm%\:%i_stc_ss%\:%i_stc_ff%': r=25:x=(w-tw)/2: y=10:fontsize=45:fontcolor=white:borderw=1:bordercolor=DarkGray" -c:v libx264 -aspect 16:9 -crf 22 -maxrate 1404k -bufsize 3000k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -c:a aac -b:a 128k -ar 48000 -ac 2 -movflags +faststart -threads 0 -map 0:a? -metadata:s:a:1 language=eng -y D:\Proxies_OUT\%s_original_name%_proxy_16x9.mp4

Works... But doesn't load the correct font.
The ffmpeg documentation says "fontfile - The font file to be used for drawing text. The path must be included. This parameter is mandatory if the fontconfig support is disabled" .
For the Custom Executor script above, I've put the font in the same directory as the ffmpeg executable, assuming that it would work just like my ffmpeg test script. But no luck.
I've also tried including every file path variation I can think of.
C:\Windows\Fonts....
\Windows\Fonts...
Single and double break etc.

Back to the documentation, "11.66 drawtext
Draw a text string or text from a specified file on top of a video, using the libfreetype library.
To enable compilation of this filter, you need to configure FFmpeg with --enable-libfreetype. To enable default font fallback and the font option you need to configure FFmpeg with --enable-libfontconfig. To enable the text_shaping option, you need to configure FFmpeg with --enable-libfribidi".

I can see that the compiled version of ffmpeg that came with FFASTrans includes --enable-libfreetype, but I don't see --enable-libfontconfig. Could that be the problem?

I still don't understand why my direct ffmpeg script using the same compile of ffmpeg works OK, but the Custom Executor version doesn't.

Re: Replace Command Executor for BITC & Watermarked H.264

Posted: Mon Feb 22, 2021 11:29 am
by emcodem
Ah, no big deal, i am sure this is not about the config that ffmpeg was built with but just about finding the font file.
There is a difference when ffastrans executes some cmd and you do: the environment vars (like PATH) might be different and the starting directory. E.g. when you run ffastrans as service, i am pretty sure the starting dir is system32. Let's just try to specify the full path to the font file:
E.g.

Code: Select all

drawtext=fontfile='C\:/Windows/Fonts/arial.ttf'
Also, i recommend to use the webinterface when developing on such workflows, you can easily read the full output of your ffmpeg and other commands.

About Custom FFmpeg VS command executor: The difference between those 2 might be a lot smaller than you think but you must make sure to delete all stuff from the textboxes like video codec and bitrate in order to avoid that it inserts anything else than the -i and output part. Anyway, the biggest difference from my perspective is that the custom ffmpeg calculates the ETA and displays it on status monitor. I always stick to use command executor for my custom ffmpegs because this way i have full control about what happens.

Re: Replace Command Executor for BITC & Watermarked H.264

Posted: Tue Feb 23, 2021 3:14 am
by MediaMogul
SOLVED

I think the main problem I had was that the font was installed for Win10 but not for all users.
The windows file path to the font was not C:\Windows\Fonts\.... but a much longer C:\Users\Username\....
Also note that the path required no drive letter, no semicolon, and the use of forward slashes in the directory path.

Working example: drawtext=fontfile=/Windows/Fonts/arial.ttf

My working Command Executor script:

D:\FFAStrans\Processors\ffmpeg\x64\ffmpeg.exe -i "%s_source%" -i D:\FFAStrans\Processors\ffmpeg\x64\iconSmall30.png -filter_complex "[0:v]crop=720:576:0:608, scale=1024:576, setsar=1[a];[a]yadif,scale=-2:576[b]; [b][1:v]overlay=main_w-overlay_w-30:main_h-overlay_h-15[c];[c]drawtext=fontfile=/Windows/Fonts/OpenSans-Regular.ttf:\timecode='%i_stc_hh%\:%i_stc_mm%\:%i_stc_ss%\:%i_stc_ff%': r=25:x=(w-tw)/2: y=10:fontsize=45:fontcolor=white:borderw=1:bordercolor=DarkGray" -c:v libx264 -aspect 16:9 -crf 22 -maxrate 1404k -bufsize 3000k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -c:a aac -b:a 128k -ar 48000 -ac 2 -movflags +faststart -threads 0 -map 0:a? -metadata:s:a:1 language=eng -y D:\Proxies_OUT\%s_original_name%_proxy_16x9.mp4

Re: Replace Command Executor for BITC & Watermarked H.264

Posted: Tue Feb 23, 2021 4:24 am
by MediaMogul
My working script for a Custom FFmpeg processor

Note: you must blank out the video codec, bitrate etc boxes in the Custom FFmpeg window, if you specify these parameters in the script.

-i D:\FFAStrans\Processors\ffmpeg\x64\iconSmall30.png -filter_complex "[0:v]crop=720:576:0:608, scale=1024:576, setsar=1[a];[a]yadif,scale=-2:576[b]; [b][1:v]overlay=main_w-overlay_w-30:main_h-overlay_h-15[c];[c]drawtext=fontfile=/Windows/Fonts/OpenSans-Regular.ttf:\timecode='%i_stc_hh%\:%i_stc_mm%\:%i_stc_ss%\:%i_stc_ff%': r=25:x=(w-tw)/2: y=10:fontsize=45:fontcolor=white:borderw=1:bordercolor=DarkGray" -c:v libx264 -aspect 16:9 -crf 22 -maxrate 1404k -bufsize 3000k -pix_fmt yuv420p -profile:v high -level 4.0 -refs 3 -r 25 -c:a aac -b:a 128k -ar 48000 -ac 2 -movflags +faststart -threads 0 -map 0:a? -metadata:s:a:1 language=eng