Share your FFmpeg buttons!

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
KozakMak
Senior Member
Senior Member
Posts: 478
Joined: 2021-05-24, 12:39 UTC
Location: UA

Share your FFmpeg buttons!

Post by *KozakMak »

okay, I know some for example:

del audio:

Code: Select all

ffmpeg.exe -i %P%N -an -vcodec copy "%O_noaudio.%E"
extract audio: (how to extract correct .ext ?)

Code: Select all

ffmpeg.exe -i %P%N -map 0:a:0 -c:a copy -vn "%O_audio.%E"
make gif:

Code: Select all

ffmpeg.exe -i %P%N -vf "fps=15,scale=320:-1:flags=lanczos" "%O.gif"
cut:

Code: Select all

?ffmpeg.exe -i %P%N -ss 00:00:00 -to 00:00:05 -c:v copy -c:a copy "%O_cut.%E"

Share what else you know! For example, how to merge selected files?
OS: Win10 | TC: latest x64
User avatar
popthezid
Junior Member
Junior Member
Posts: 14
Joined: 2024-11-23, 03:44 UTC

Re: Share your FFmpeg buttons!

Post by *popthezid »

Convert to H264 (original)

Code: Select all

ffmpeg -y -hwaccel dxva2 -threads 6 -i %P%S -c:v h264_qsv -c:a aac -b:a 128k -ac 2 -b:v 3500k -profile:v main -preset slower "%O"_H264.mp4
Convert to H265 (1280x720)

Code: Select all

ffmpeg -y -hwaccel dxva2 -threads 6 -i %P%S -c:v hevc_qsv -c:a aac -b:a 128k -ac 2 -b:v 3500k -vf scale=1280:720 "%O"_720pHEVC.mp4
Merge selected video

Code: Select all

%COMSPEC%
chcp 65001 && (for %%i in (%s) do @echo file '%%i') > listfile.txt && ffmpeg.exe -f concat -safe 0 -i listfile.txt -c copy "MergeOutput.mp4" && del listfile.txt
lic#206911
Windows10 22H2 Home
Total Commander 11.50 32bit / 3.50d
KozakMak
Senior Member
Senior Member
Posts: 478
Joined: 2021-05-24, 12:39 UTC
Location: UA

Re: Share your FFmpeg buttons!

Post by *KozakMak »

popthezid wrote: 2025-01-08, 10:39 UTC Merge selected video
doesn't work
okey, figured out - must be '%%~fi'

...but it doesn't work with Cyrillic in the paths.
OS: Win10 | TC: latest x64
CoolWater
Power Member
Power Member
Posts: 744
Joined: 2003-03-27, 16:33 UTC

Re: Share your FFmpeg buttons!

Post by *CoolWater »

Therefore you need the chcp command to change the codepage in order to support cyrillic letters.

HTH
CoolWater
KozakMak
Senior Member
Senior Member
Posts: 478
Joined: 2021-05-24, 12:39 UTC
Location: UA

Re: Share your FFmpeg buttons!

Post by *KozakMak »

2CoolWater
just stop being poor (c)

answered like meme :lol:
OS: Win10 | TC: latest x64
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1049
Joined: 2004-07-29, 11:00 UTC

Re: Share your FFmpeg buttons!

Post by *ZoSTeR »

 
I mainly use these three CMDs on a button to with parameter "%P%O.%E"

Convert audio to AC3:

Code: Select all

%~dp0ffmpeg.exe -i %1 -map 0 -vcodec copy -scodec copy -acodec ac3 -b:a 640k "%~dpn1-AC3.mkv"
Convert to 720p x264 and AC3:

Code: Select all

%~dp0ffmpeg.exe -i %1 -map 0 -vf scale=1280:-2 -c:v libx264 -pix_fmt yuv420p -crf 18 -preset slow -scodec copy -acodec ac3 -b:a 640k "%~dpn1-720p-AC3.mkv"
Convert with Nvidia NVENC:

Code: Select all

%~dp0ffmpeg.exe -hwaccel_output_format cuda -i %1 -map 0 -c:v h264_nvenc -pix_fmt yuv420p -preset fast -rc vbr -cq 25 -b:v 0K -scodec copy -acodec copy "%~d1%~p1%~n1-720p-nv.mkv"
NVENC was not very well documented and there might have been changes...


The "-map 0" parameter copies all subtitles and other streams.

The "-vf scale=1280:-2" keeps the correct aspect ratio when scaling to 720p.
User avatar
popthezid
Junior Member
Junior Member
Posts: 14
Joined: 2024-11-23, 03:44 UTC

Re: Share your FFmpeg buttons!

Post by *popthezid »

KozakMak wrote: 2025-01-08, 13:32 UTC
popthezid wrote: 2025-01-08, 10:39 UTC Merge selected video
doesn't work
okey, figured out - must be '%%~fi'

...but it doesn't work with Cyrillic in the paths.
Because FFmpeg concat merging protocol, can only read text files in UTF-8 encode format.
Using system cmd.exe run this bat can generate txt in utf-8 encode format.
However, when TC called the command line, CHCP 65001 is ok,but generate UTF-8 encode txt it failed.
My solution is to integrate TCC/LE in TC to run this bat, which can generate UTF-8 encode text correctly.
lic#206911
Windows10 22H2 Home
Total Commander 11.50 32bit / 3.50d
KozakMak
Senior Member
Senior Member
Posts: 478
Joined: 2021-05-24, 12:39 UTC
Location: UA

Re: Share your FFmpeg buttons!

Post by *KozakMak »

popthezid wrote: 2025-01-10, 03:28 UTC My solution is to integrate TCC/LE in TC to run this bat, which can generate UTF-8 encode text correctly.
Can you give more details?
OS: Win10 | TC: latest x64
User avatar
popthezid
Junior Member
Junior Member
Posts: 14
Joined: 2024-11-23, 03:44 UTC

Re: Share your FFmpeg buttons!

Post by *popthezid »

KozakMak wrote: 2025-01-10, 07:37 UTC
popthezid wrote: 2025-01-10, 03:28 UTC My solution is to integrate TCC/LE in TC to run this bat, which can generate UTF-8 encode text correctly.
Can you give more details?
you can download TCC/LE from https://jpsoft.com/all-downloads/all-downloads.html and install it. (FREEWARE)
in TC bar , define TCC/LE exe path to use it.

Code: Select all

Command: tcc.exe
Parameters: chcp 65001 && (for %%i in (%s) do @echo file '%%i') > listfile.txt && ffmpeg.exe -f concat -safe 0 -i listfile.txt -c copy "MergeOutput.mp4" && del listfile.txt
lic#206911
Windows10 22H2 Home
Total Commander 11.50 32bit / 3.50d
Post Reply