I am trying to create a loop that will process all .mp4 (gopro clips) in a folder, and output each converted file with the same filename as the original + the _r suffix. I puzzled together the below from various sources but can't get it to work.
for i in *.mp4; do ffmpeg -i "$i" -vf "hflip,vflip" "${i%.*}_r.mp4"; done
Running the above gives the following error.
*.mp4: No such file or directory
What have I done wrong?
Yes, I am in the correct directory, and there are .mp4 files in in place.
Ffmpeg is installed and runs correctly.
Working in Mac terminal.
Related
I would like to convert a large number of html files to txt files. I have downloaded the inscript command line tool from github but I am struggling to apply it to all html files which are located in subdirectories and then save these files as text files in the same directory where the html files are located.
I have tried:
for f in ./ do inscript.py -o test.txt done
The following should work:
for d in ./**/*/; do
pushd "$d"
for f in *.html(N); do
out=test-${f%.html}.txt
inscript.py -o "$out" "$f"
done
popd
done
The pattern .**/*/ will recursively match the current directory and all its subdirectories. pushd will change to a directory, but remember the current working directory. inscript.py does its thing, then popd returns to the original working directory so that the next value of d continues to be a valid
relative directory.
Changing the working directory isn't strictly necessary; it just simplifies the file paths involved, because you focus on the name of the file and ignore the rest of the path.
I have a folder containing number of files with extensions in .xvg format and i need to change them into .dat format. How can i do that..?
What are the commands that i need to give such that all those files extensions that are in .xvg format are converted into .dat format [without the file name getting changed,(example., abc.xvg should be converted into abc.dat),only file extension should be changed].
Try this
rename 's/.xvg$/.dat/' *.xvg
For a test run you can use this command:
rename 's/.xvg$/.dat/' *.xvg -vn
-v means "verbose" and it will output the names of the files when it renames them.
-n will do a test run where it won't rename any files, But will show you a list of files that would be renamed.
I want to create a batch/shell script for windows and mac that will take few different files with different types and will compress it to a .zip file.
I already saw a few questions and answers about it, but all of them either compress all the files in the folder or compress them individually.
Example (look at attached image):
I have a folder that contains 1.txt, 2.xml, a sub directory.
And I want to turn all of them into a .zip file.
If possible to get a solution both for windows and Mac.
On Windows there is the file 7zip.chm in directory %ProgramFiles%\7-Zip which is the help file of 7-Zip. Double click on this file to open the help.
On Contents tab there is the list item Command Line Version with the help pages:
Syntax ... Command Line Syntax
Commands ... Command Line Commands
Switches ... Command Line Switches
The target is to compress everything in folder test into a ZIP file with name of the folder as file name.
This could be done for example with the command line:
"%ProgramFiles%\7-Zip\7z.exe" a -bd -mx=9 -r -y -- test.zip "C:\Path to Directory\test\*"
This command line adds (a) everything in directory C:\Path to Directory\test recursive (-r) to a ZIP file with name test.zip in current working directory without progress indicator (-bd) using best ZIP compression (-mx=9) with assuming Yes on all queries (-y).
In other words the file test.zip in current directory contains after execution the subdirectory main with everything inside and the files 1.txt and 2.xml.
I have multiple mkv files in a ubuntu directory.I have installed 'avconv' tool and its working fine. My aim is to simple concatenate all those files and produce a single mkv file.
I referenced so many articles and found that this command should serve the purpose:
avconv -i "concat:1-1.mkv|1-2.mkv|1-3.mkv" -c copy 1.mkv
However, when I run it, I get error:
concat:1-1.mkv|1-2.mkv|1-3.mkv: No such file or directory
I even tried it with mp4 files but still the same error.
Can anyone point out what wrong I am doing ?
Or there is any other approach ?
ffmpeg may turn out to be a better alternative. There is an entire wiki-page about concatenation of media files with ffmpeg.
Alternatively, try the mkvmerge utility:
mkvmerge -o 1.mkv 1-1.mkv + 1-2.mkv + 1-3.mkv
me again :P
I have some problems with some bat file, that bat file , connects to and ftp and download all files from a remote folder, then delete it, but my problem/question is: i need a txt(log) of every file before download it from the remote server, here is my file
bat file:
ftp -i -s:ftpfile.txt site.com
txt file
user-name
user-pass
lcd c:\localfolder\some\folder
cd remotefolder-name
mget .
mdelete \\remotefolder-name\ .
quit
If i use the >>mylog.txt on this line:
ftp -i -s:ftpfile.txt site.com>>mylog.txt
I get some extra data that i dont want to. I just need the file names before download it, something like this:
log.txt
file001x.xml
filedfx.xml
file023x.xml
filed33x.xml
Ps:sorry for my english ;)
You may redirect ls output to local file. Syntax is: ls pattern local_file. An example would be: ls * ftplist.txt or ls . ftplist.txt. Both will produce a file ftplist.txt (in local current directory if you do not specify path) with a list of files (and possibly subdirs) in current directory on remote server (in slightly different formats)