MattMcManis / Axiom

An FFmpeg GUI for Windows
https://axiomui.github.io
GNU General Public License v3.0
1.49k stars 116 forks source link

[FEATURE REQ] CMD options #48

Open jorgebr opened 4 years ago

jorgebr commented 4 years ago

Hi, I always manually edit the script as follows: (1) Add START "" /B /LOW before the ffmpeg command. This opens a new window running in /LOW priority. Sometimes I use /BELOWNORMAL

(2) I change "-y" (overwrite output files) to "-n" (never overwrite output files) Example:

START "" /B /LOW "C:\Users\user\path\to\Axiom 1.8.9.0\ffmpeg\bin\ffmpeg.exe" 

-n 

-i "input.mp4" 

If the GUI had options for adding those, it would be great. For example:

Thanks for this wonderful work!

MattMcManis commented 4 years ago

Hi, thanks for using Axiom.

I will work on adding a Priority dropdown menu with different levels.

And an overwrite toggle button that will set it to -y or -n.

I will have it save their state to the config file so you won't have to switch them every time.

MattMcManis commented 4 years ago

@jorgebr

How are you using the Priority with 2 Pass?

When I set START "" /B /LOW for ffmpeg pass 2, I get the errors:

Failed to initialize encoder: Invalid parameter
Additional information: rc_twopass_stats_in.buf not set.

and Pass 2 does not start.


Update: I think I found the solution, it's start /low /wait /b.

jorgebr commented 4 years ago

Great! I only use CRF, so I didn't think about the implications for 2-pass. Great you figured it out.

Thanks for working on this!

MattMcManis commented 4 years ago

@jorgebr

I've almost finished it, I'm just getting Process Priority to work with PowerShell and Batch Processing.

It will work with CMD, PowerShell, CRF, 1 Pass, 2 Pass, Batch, and YouTube-DL.


The new menus are going to look like this:

Menus

Priority

Overwrite

jorgebr commented 4 years ago

Perfect! Thank you!

MattMcManis commented 4 years ago

@jorgebr

I've released an update v1.9.0.0. Let me know how it works. It will need more testing.

Press the arrow button in Axiom to update through PowerShell, or download from here
https://github.com/MattMcManis/Axiom/releases

Update


Process Priority Script Examples:

Axiom will now generate these scripts.

CMD

1 Pass / CRF

start "" /b /wait /belownormal ffmpeg -i "C:\path\to\video.mpg" -c:v libvpx -b:v 1300K "C:\path\to\video.webm"

2 Pass

start "" /b /wait /belownormal ffmpeg -i "C:\path\to\video.mpg" -c:v libvpx -b:v 1300K -pass 1 NUL &&
start "" /b /wait /belownormal ffmpeg -i "C:\path\to\video.mpg" -c:v libvpx -b:v 1300K -pass 2 "C:\path\to\video.webm"

Batch

1 Pass / CRF

cd /d "C:\path\to\" && 

for %f in (*.mpg) do (echo) && 

start "" /b /wait /belownormal ffmpeg 

-i "C:\path\to\%f" -c:v libvpx -b:v 1300K "C:\path\to\%~nf.webm"

PowerShell

1 Pass / CRF

($Process = Start-Process ffmpeg -NoNewWindow -ArgumentList '-i "C:\path\to\video.mpg" -c:v libvpx -b:v 1300K "C:\path\to\video.webm"' -PassThru).PriorityClass = [System.Diagnostics.ProcessPriorityClass]::BelowNormal; Wait-Process -Id $Process.id

2 Pass

($Process = Start-Process ffmpeg -NoNewWindow -ArgumentList '-i "C:\path\to\video.mpg" -c:v libvpx -b:v 1300K -pass 1 NUL' -PassThru).PriorityClass = [System.Diagnostics.ProcessPriorityClass]::BelowNormal; Wait-Process -Id $Process.id;

($Process = Start-Process ffmpeg -NoNewWindow -ArgumentList '-i "C:\path\to\video.mpg" -c:v libvpx -b:v 1300K -pass 2 "C:\path\to\video.webm"' -PassThru).PriorityClass = [System.Diagnostics.ProcessPriorityClass]::BelowNormal; Wait-Process -Id $Process.id;

Batch

1 Pass / CRF

$files = Get-ChildItem "C:\path\to\" -Filter *.mpg;

foreach ($f in $files) {

    $fullName = $f.FullName; 
    $inputName = $f.Name; 
    $outputName = (Get-Item $inputName).Basename; 

    ($Process = Start-Process ffmpeg -NoNewWindow -ArgumentList '-i "C:\path\to\video.mpg" -c:v libvpx -b:v 1300K "C:\path\to\video.webm"' -PassThru).PriorityClass = [System.Diagnostics.ProcessPriorityClass]::BelowNormal; Wait-Process -Id $Process.id
}

Call Operator

If Process Priority is Default

If using FFmpeg / FFprobe Full Path, uses Call Operator &

& "C:\path\to\ffmpeg\bin\ffmpeg.exe" 
& "C:\path\to\ffmpeg\bin\ffprobe.exe" 

If Process Priority is Low, Normal, High, etc. uses Start-Process

Start-Process "C:\path\to\ffmpeg\bin\ffmpeg.exe" 

If using Environment Variable

ffmpeg
ffprobe
jorgebr commented 4 years ago

Amazing! So far, it's working perfectly. Thank you!

MattMcManis commented 4 years ago

@jorgebr

Thanks, this was a good feature suggestion.

I'll leave this thread open for few weeks. Report back if you come across any problems.

MattMcManis commented 4 years ago

@jorgebr

I found an error with External Subtitles using PowerShell and Process Priority.

In the next update I will be changing -ArgumentList to use double quotes " instead of single ', and it will escape `" double quoted filters and paths.


Before

-ArgumentList '-i "C:\path\to\video.mpg" -c:v libvpx -b:v 1300K -vf "subtitles='C\:\\path\\to\\subtitles.srt'" "C:\path\to\video.webm"'

After

-ArgumentList "-i `"C:\path\to\video.mpg`" -c:v libvpx -b:v 1300K -vf `"subtitles='C\:\\path\\to\\subtitles.srt'`" `"C:\path\to\video.webm`""