rush icon indicating copy to clipboard operation
rush copied to clipboard

[Question] How to run commends that include flags.

Open someonenameguy opened this issue 1 year ago • 7 comments

Prerequisites

  • [x] make sure you're are using the latest version by rush -V

  • [x] read the usage (rush -h) and examples

  • Running windows 64-bit version in commend prompt

Describe your issue

  • [x] describe the problem
  • [x] provide a reproducible example

I want to run a commend but rush keep detecting the flag in the commend. The commend being: ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e="-c:a libmp3lame -ar 44100 -b:a 32k -abr 2 -ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\someone\Desktop\FFBatch\normalized"

I tried this which gave me error of unknown shorthand flag: 's' in -sn

dir /b | rush -q -j6 'ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e="-c:a libmp3lame -ar 44100 -b:a 32k -abr 2 -ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" {}'

Then I tried this which didn't work:

dir /b | rush -j6 'ffmpeg-normalize \-sn \-cn \-t \-16 \-lrt 50 \-tp \-1.5 \-\-keep\-lra\-above\-loudness\-range\-target \-vn \-e="\-c:a libmp3lame \-ar 44100 \-b:a 32k \-abr 2 \-ac 1 \-q 0" \-c:a mp3 \-ext mp3 \-of "C:\Users\kevan\Desktop\FFBatch\normalized" {}'

I also tried add -q or -Q or using / instead of \ but didn't reach a working commend.

Am I missing something?

someonenameguy avatar Oct 20 '24 04:10 someonenameguy

does cmd accept single quote? try

rush "xxx -x \"yyy\" "

shenwei356 avatar Oct 20 '24 05:10 shenwei356

Thanks! I got it to work with:

dir /B | rush -j=6 "ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e \"-c:a libmp3lame -ar 44100 -b:a 32k -abr 2 -ac 1 -q 0\" -c:a mp3 -ext mp3 -of \"C:\Users\kevan\Desktop\FFBatch\normalized\" \"{}\""

someonenameguy avatar Oct 20 '24 09:10 someonenameguy

Nvm I found a new issue. Running the cmd with --dry-run I see weird outputs where the last {}\" is placed in the wrong place. image

ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2"-ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" "Working My Way Back To You - The Spinners.ogg
ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2"-ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" "Worldinvader - EBIMAYO.ogg
ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2"-ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" "Yeehaw Deliveryboy - ClascyJitto.ogg
ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2"-ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" "You Win Again - Bee Gees.ogg
ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2"-ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" "寶貝,對不起 - Grasshopper.ogg
ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2"-ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" "豆漿油條 - JJ Lin.ogg
ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2"-ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" "陽光彩虹小白馬 - Wowkie Da.ogg

someonenameguy avatar Oct 20 '24 14:10 someonenameguy

Looks good to me (in Linux):

$ ls *.ogg | head -n 3 |  rush "ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e \"-c:a libmp3lame -ar 44100 -b:a 32k -abr 2 -ac 1 -q 0\" -c:a mp3 -ext mp3 -of \"C:\Users\kevan\Desktop\FFBatch\normalized\" \"{}\"" --dry-run
ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2 -ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" "Addicted to Love - Tina Turner.ogg"
ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2 -ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" "All That She Wants (Remastered) - Ace of Base.ogg"
ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2 -ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" "A Good Song Never Dies - Saint Motel.ogg"

What happened if you remove --dry-run?

shenwei356 avatar Oct 21 '24 02:10 shenwei356

12:19:47.654 [ERRO] wait cmd #1: ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2 -ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\nor": exit status 1Had) The Time of My Life - Jennifer Warnes & Bill Medley.mp3
12:19:48.565 [CRIT] received an interrupt, stopping unfinished commands...
": exit status 1RO] wait cmd #3: ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e "-c:a libmp3lame -ar 44100 -b:a 32k -abr 2 -ac 1 -q 0" -c:a mp3 -ext mp3 -of "C:\Users\kevan\Desktop\FFBatch\normalized" "04._With_Friendship_&_Peace_128_16842960.mp3
12:22:32.069 [CRIT] received an interrupt, stopping unfinished commands...

someonenameguy avatar Oct 21 '24 04:10 someonenameguy

The last " seems to be placed base on the command prompt scale/word wrap. image image image If I resize after the output the " moves not sure why it replaced the 1 for most but one of the output has the 1 still. image

someonenameguy avatar Oct 21 '24 04:10 someonenameguy

I don't now. How about use the default cmd of Windows?

I just installed the latest ffmpeg (from here), python 3.13.0 and install https://github.com/slhck/ffmpeg-normalize with pip, in a Windows 10 VM.

I downloaded an ogg file from here and save it into C:\Users\shenwei\Desktop\test.

I used the command below (-abr 2 is not used as it reported that 2 should be a boolean value), and it worked.

cd C:\Users\shenwei\Desktop\test

dir /b 
file_example_OOG_1MG.ogg

dir /b | rush  "ffmpeg-normalize -sn -cn -t -16 -lrt 50 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e \"-c:a libmp3lame -ar 44100 -b:a 32k -ac 1 -q 0\" -c:a mp3 -ext mp3 -of \"C:\Users\shenwei\Desktop\test\" \"{}\""

dir /b
file_example_OOG_1MG.mp3
file_example_OOG_1MG.ogg

shenwei356 avatar Oct 21 '24 05:10 shenwei356

I used the command below (-abr 2 is not used as it reported that 2 should be a boolean value), and it worked. That was typo on my side I mean to set -ac to 2 not -abr to 2.

I updated ffmpeg to N7.1 and ffmpeg-normalize from 1.28.2 to 1.29.0 Also I ran chcp 65001 before hand.

I'm trying this command for now if there no error will close this issue.

dir /b | rush -j6  "ffmpeg-normalize -v -sn -cn -t -16 -lrt 12 -tp -1.5 --keep-lra-above-loudness-range-target -vn -e \"-c:a libmp3lame -ar 44100 -b:a 32k -ac 2 -q 0\" -c:a mp3 -ext mp3 -of \"C:\Users\kevan\Desktop\Music\Song\normalized\" \"{}\""

someonenameguy avatar Oct 21 '24 07:10 someonenameguy

Hmm still have issues with some files. If I do a echo test this happens:

\Desktop\CD>dir /b | rush -j1 "echo {}"
#SELFIE is a new and original song which doesn't plagiarize at all [-1zeoDrN2Lo].webm
20 Percent Cooler [aErHrtr1xgQ].webm
...
Cheeki Breeki (Remix) [UIoefetP7wQ].webm
'Ellen' is not recognized as an internal or external command,
operable program or batch file.
: exit status 1RRO] wait cmd #12: echo Count to Three (feat. The Stupendium & Ellen McLain) [70ocdx2SioY].webm
Count to Three (feat. The Stupendium
...
Eszett [8Le-zYZSUwY].webm
Fei Ren Zai Opening Song 非人哉主题曲《非人哉》(HQ) [4bySzbj-HlU].webm
Fine [de0kFiLuW0o].webm
'MC' is not recognized as an internal or external command,
operable program or batch file.
: exit status 1RRO] wait cmd #17: echo Friendzoned (feat. Mixie Moon & MC Offside) [rNK1xxrcsLs].webm
Friendzoned (feat. Mixie Moon
Funkytown [OAC4ItP0xWM].webm
...
Year 3 Billion [AlbvlPki7KY].webm
有兽焉 (《有兽焉》动画主题曲) [iwlfROdx-6Y].webm
Full Log

\Desktop\CD>dir /b | rush -j1 "echo {}"
#SELFIE is a new and original song which doesn't plagiarize at all [-1zeoDrN2Lo].webm
20 Percent Cooler [aErHrtr1xgQ].webm
AAAAAAAAAAAAAAAAAA [R2MidGDFZpg].webm
Absolute Territory [DTVN5bsnp4A].webm
ALESTORM - P.A.R.T.Y. (Official Video) | Napalm Records [c967usVxYq0].webm
Anya Nami - Bread (Official Music Video) [J1DAmmROUX8].webm
Battle of the Shampoo Bottles [2T_bj1Ve9mU].webm
Big Bad Wolf [rJ5p1Ov2bl0].webm
Business Man [RSxHwdc6NLU].webm
But Can You Do This [pfFItK9-Mqs].webm
Cheeki Breeki (Remix) [UIoefetP7wQ].webm
'Ellen' is not recognized as an internal or external command,
operable program or batch file.
: exit status 1RRO] wait cmd #12: echo Count to Three (feat. The Stupendium & Ellen McLain) [70ocdx2SioY].webm
Count to Three (feat. The Stupendium
DJ Whore (feat. Tamika) [5TaRr-w14wg].webm
Eszett [8Le-zYZSUwY].webm
Fei Ren Zai Opening Song 非人哉主题曲《非人哉》(HQ) [4bySzbj-HlU].webm
Fine [de0kFiLuW0o].webm
'MC' is not recognized as an internal or external command,
operable program or batch file.
: exit status 1RRO] wait cmd #17: echo Friendzoned (feat. Mixie Moon & MC Offside) [rNK1xxrcsLs].webm
Friendzoned (feat. Mixie Moon
Funkytown [OAC4ItP0xWM].webm
good 4 u is a new and original song which doesn't plagiarize at all [XBSZ5yvB5mo].webm
H.Y.C.Y.BH [0ek7ASqYAuU].webm
Hey I Don't Work Here [BbDa5nbwnpQ].webm
Hold My Hand [UGPuToWrnsY].webm
I Will Pick You up (feat. Tamika) [J8MYkqM8wYY].webm
In the Store [psy_xL0HqoI].webm
Live Laugh Lüfte (Live) [WDPOw7XWC3I].webm
PERCEPTION CHECK [U9CwShiwj30].webm
Please Move [mZBFNmWs29c].webm
Pruit Igoe [LF-YT5UhB9g].webm
Pvp [Zm4Y4EV2gso].webm
Ravers Mashup [SdecZrIGZkw].webm
Red Flags (feat. Montaigne) [5T3YXN80qpo].webm
Rodney Munch - It's Time To Take a Sh*t on the Company​’​s Dime (FULL SONG) [7zTei5RMhQ8].webm
Ryder or Riot [shrEpzyjfwQ].webm
S3RL - MTC (Best Instrumental On YouTube) [NCg3fhJUz9M].webm
Shoulder Boulders [-BDziqDpcHo].webm
Six Shooter [Y2shDoIBJIs].webm
Slut (Original Mix) [e2k2R0RojkY].webm
Smartphone Calling Back [d6LMbv9BzKs].webm
song that plays when you encounter a caterpillar [3LGdFKIXr9I].webm
Sorry Jack [nb525VkPPtg].webm
Starlight Brigade [j6hAqPdz5lE].webm
Strangers (feat. EileMonty) [RvUPoPcru-0].webm
Sucker is a new and original song which doesn't plagiarize at all [PN-zHSvDc1g].webm
Sylt [qeMjziHID8Q].webm
The Search Engine Song [aCQcZOO6qe8].webm
Touch Fluffy Tail [GWdZIoowpw4].webm
Union Dixie - Eurobeat Remix [g73sUvX3Kg4].webm
Welcome to Team Fortress [Osdh9Nk2mu8].webm
Year 3 Billion [AlbvlPki7KY].webm
有兽焉 (《有兽焉》动画主题曲) [iwlfROdx-6Y].webm
Filenames

Desktop\CD>dir /b
#SELFIE is a new and original song which doesn't plagiarize at all [-1zeoDrN2Lo].webm
20 Percent Cooler [aErHrtr1xgQ].webm
AAAAAAAAAAAAAAAAAA [R2MidGDFZpg].webm
Absolute Territory [DTVN5bsnp4A].webm
ALESTORM - P.A.R.T.Y. (Official Video) | Napalm Records [c967usVxYq0].webm
Anya Nami - Bread (Official Music Video) [J1DAmmROUX8].webm
Battle of the Shampoo Bottles [2T_bj1Ve9mU].webm
Big Bad Wolf [rJ5p1Ov2bl0].webm
Business Man [RSxHwdc6NLU].webm
But Can You Do This [pfFItK9-Mqs].webm
Cheeki Breeki (Remix) [UIoefetP7wQ].webm
Count to Three (feat. The Stupendium & Ellen McLain) [70ocdx2SioY].webm
DJ Whore (feat. Tamika) [5TaRr-w14wg].webm
Eszett [8Le-zYZSUwY].webm
Fei Ren Zai Opening Song 非人哉主题曲《非人哉》(HQ) [4bySzbj-HlU].webm
Fine [de0kFiLuW0o].webm
Friendzoned (feat. Mixie Moon & MC Offside) [rNK1xxrcsLs].webm
Funkytown [OAC4ItP0xWM].webm
good 4 u is a new and original song which doesn't plagiarize at all [XBSZ5yvB5mo].webm
H.Y.C.Y.BH [0ek7ASqYAuU].webm
Hey I Don't Work Here [BbDa5nbwnpQ].webm
Hold My Hand [UGPuToWrnsY].webm
I Will Pick You up (feat. Tamika) [J8MYkqM8wYY].webm
In the Store [psy_xL0HqoI].webm
Live Laugh Lüfte (Live) [WDPOw7XWC3I].webm
PERCEPTION CHECK [U9CwShiwj30].webm
Please Move [mZBFNmWs29c].webm
Pruit Igoe [LF-YT5UhB9g].webm
Pvp [Zm4Y4EV2gso].webm
Ravers Mashup [SdecZrIGZkw].webm
Red Flags (feat. Montaigne) [5T3YXN80qpo].webm
Rodney Munch - It's Time To Take a Sh*t on the Company​’​s Dime (FULL SONG) [7zTei5RMhQ8].webm
Ryder or Riot [shrEpzyjfwQ].webm
S3RL - MTC (Best Instrumental On YouTube) [NCg3fhJUz9M].webm
Shoulder Boulders [-BDziqDpcHo].webm
Six Shooter [Y2shDoIBJIs].webm
Slut (Original Mix) [e2k2R0RojkY].webm
Smartphone Calling Back [d6LMbv9BzKs].webm
song that plays when you encounter a caterpillar [3LGdFKIXr9I].webm
Sorry Jack [nb525VkPPtg].webm
Starlight Brigade [j6hAqPdz5lE].webm
Strangers (feat. EileMonty) [RvUPoPcru-0].webm
Sucker is a new and original song which doesn't plagiarize at all [PN-zHSvDc1g].webm
Sylt [qeMjziHID8Q].webm
The Search Engine Song [aCQcZOO6qe8].webm
Touch Fluffy Tail [GWdZIoowpw4].webm
Union Dixie - Eurobeat Remix [g73sUvX3Kg4].webm
Welcome to Team Fortress [Osdh9Nk2mu8].webm
Year 3 Billion [AlbvlPki7KY].webm
有兽焉 (《有兽焉》动画主题曲) [iwlfROdx-6Y].webm

someonenameguy avatar Oct 21 '24 11:10 someonenameguy

Add -q for files with special characters

  -q, --escape                    escape special symbols like $ which you can customize by flag
                                  -Q/--escape-symbols

  -Q, --escape-symbols string     symbols to escape (default "$#&`")

shenwei356 avatar Oct 21 '24 14:10 shenwei356

That still cause issues as the program will see the \& as new dir/loc. Command used: dir /b | rush -q -j5 "ffmpeg-normalize -v -sn -cn -vn --keep-lra-above-loudness-range-target -c:a libopus -e=\"-b:a 200k -vbr 1 -compression_level 10 -frame_duration 60 -map_metadata 0 -map_metadata 0:s:0 -id3v2_version 3\" -ext ogg -of \"C:\Users\kevan\Desktop\FFBatch\" \"{}\""

INFO: Normalized file written to C:\Users\kevan\Desktop\FFBatch\Choice - Jack Stauber's Micropop.ogg
WARNING: Input file 'Mirror Man - Adult Swim Smalls \& Jack Stauber's Micropop.ogg' does not exist, skipping
INFO: Normalizing file New Normal - Jack Stauber.ogg (1 of 1)
dir /b | rush -qkj1 "echo \"{}\""
"Al Dente - Jack Stauber's Micropop.mp3"
"Baby Hotline - Jack Stauber's Micropop.mp3"
"Choice - Jack Stauber's Micropop.mp3"
"Inchman - Jack Stauber's Micropop.mp3"
"Keyman - Jack Stauber's Micropop.mp3"
"Mirror Man - Adult Swim Smalls \& Jack Stauber's Micropop.ogg"
"New Normal - Jack Stauber.ogg"
"There's Something Happening - Jack Stauber's Micropop.mp3"
"Those Eggs Aren't Dippy - Jack Stauber's Micropop.mp3"
"Two Time - Jack Stauber's Micropop.mp3"

someonenameguy avatar Oct 22 '24 02:10 someonenameguy

I copied the previous test file and renamed them to 4 cases (with Chinese characters, symbols &, (, ), [, ], *, '), running commands below worked (without -q).

cd Desktop\test
chcp 65001

dir /b

dir /b | rush -j5  "ffmpeg-normalize -v -sn -cn -vn --keep-lra-above-loudness-range-target -c:a libopus -e=\"-b:a 200k -vbr 1 -compression_level 10 -frame_duration 60 -map_metadata 0 -map_metadata 0:s:0 -id3v2_version 3\" -ext ogg -of \"C:\Users\shenwei\Desktop\test\" \"{}\""

Screenshot:

image

shenwei356 avatar Oct 22 '24 05:10 shenwei356

Thank you for the help. I guess the cmd is just a bit weird.

someonenameguy avatar Oct 22 '24 06:10 someonenameguy