Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th September 2023, 20:50   #1  |  Link
wiseant
Registered User
 
Join Date: May 2007
Posts: 146
find Linux bash script equivalent to Windows batch file

Hi

I have some simple Windows batch files and Linux bash scripts using ffmpeg

I can demux a folder of mp4 files to m4v files in Windows

for %%a in *.mp4 do "c:\ffmpeg\bin\ffmpeg" -i "%%a" -an -c:v copy "%%a.demuxed.m4v"
pause

I can do the same thing in Linux with this bash script

#!/bin/bash
for mediafile in *.mp4; do
ffmpeg -i "$mediafile" -an -vcodec copy "${mediafile%.*}.m4v"
done

However, I have been unable to find a Linux bash script equivalent for

c:\ffmpeg\bin\ffmpeg -i "%~dpnx1" -an -c:v copy "%~dpn1.m4v"
pause

I can drag and drop a mp4 file and demux the video to a m4v file in Windows

%~dpnx1 which expands to the drive, path, name and extension of the first argument

I have searched far and wide and have not found a Linux equivalent for -i "%~dpnx1"

TIA
wiseant is offline   Reply With Quote
Old 17th September 2023, 11:42   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,990
I aint no linux guy (yet), I forgot everything I did know back in mid 90's -> about 2000.

Method would seem to be reliant upon OS Window Manager and maybe File Manager, so you might wanna say what you are using for better assistance.

Maybe try look here for some clues::

FFMPEG Drag and Drop sh file:- https://stackoverflow.com/questions/...d-drop-sh-file

Hope you find an answer.

EDIT: Might wanna see this too (I aint watched it) Drag and Drop files to a BASH Shell Script:- https://www.youtube.com/watch?v=gUb5g0J963o
EDIT: Above Youtube guy has lotsa clips on scripting and such.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 17th September 2023 at 11:49.
StainlessS is offline   Reply With Quote
Old 17th September 2023, 18:18   #3  |  Link
wiseant
Registered User
 
Join Date: May 2007
Posts: 146
@StainlessS

Thanks for the links

I am on Xubuntu - with xfce4-terminal and thunar file manager
wiseant is offline   Reply With Quote
Old 17th September 2023, 21:32   #4  |  Link
wiseant
Registered User
 
Join Date: May 2007
Posts: 146
Looks like I found a solution

In Linux I created this bash script named audio_video_demux.sh

#!/bin/bash
ffmpeg -i "$1" -vn -acodec copy "${1%.*}.m4a"
ffmpeg -i "$1" -an -vcodec copy "${1%.*}.m4v"
$SHELL

then with a right-click on a video file I use the "Open With" dialog - "Open With Other Application" then "> Use a custom command " and I typed in

/home/unoit/audio_video_demux.sh

the "${1%.*}.m4a" removes the original extension and adds the .m4a extension
the "${1%.*}.m4v" removes the original extension and adds the .m4v extension

I can select one or more video files and it processes them

If i want to see the terminal with the ffmpeg banner and the output I need to drag the bash script to the terminal then drag the video[s] to the terminal

Last edited by wiseant; 17th September 2023 at 22:27. Reason: add information
wiseant is offline   Reply With Quote
Reply

Tags
linux bash windows batch

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:46.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.