Sunday, October 20, 2019

conversion - ffmpeg multi convert videos and put them in the same path


I am using FFMPEG for converting from MOV to FLV on Ubuntu.


My problem is I have 10 folders and sub folders that contains those videos, I want a command line or a way in WinFF GUI to convert them all at ONCE not one by one and put them back in there folders so each conversion destination is the same as the video being converted.


Additionally I have a problem with the answer I have got is that it cannot convert videos not written in English or even if the path is not written in English such as Arabic.


Answer



In bash (ie ubuntu) you would do


for file in $(cat filelist.txt)
do
ffmpeg -i $file $(echo $file|sed 's/\.[^.]*$//').flv
done

Or if the subdirectories are in the same tree


find . -type f -name \*mov|
while read file
do
ffmpeg -i $file $(echo $file|sed 's/\.[^.]*$//').flv
done

Hmmm, only saw you are on Ubuntu after writing up the windows part :-)
On windows, you can use the for command:


makeflv.bat:


setlocal
set file=%1
for %%f in (%file%) do (
set name=%%~nf
set directory=%%~pf
ffmpeg -i %file% %directory%%name%.flv
)

Then call it for each file you want to convert, ie makeflv test.mov
If you have the list in a file it would be


for /f %f in ('type filelist.txt') do makeflv %f

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...