Results 1 to 3 of 3
Hi I am trying to dothe following.
I have a movie server and I want to convert my avi movies to mkv files automaticly.
in below code I try to ...
- 10-11-2011 #1Just Joined!
- Join Date
- Oct 2011
- Posts
- 1
String manipulation help needed
Hi I am trying to dothe following.
I have a movie server and I want to convert my avi movies to mkv files automaticly.
in below code I try to find the name of the avi file present in the folder, and strip the extension of it so I can use the same name as the original for the mkv file.
my output is:
Code:we will be using dexterS6E2.avi as input videofile ./run.sh: line 4: dexterS6E2: No such file or directory
I have also tried to use the expr lengt and results in the same outputCode:#/bin/bash INPUTFILE=`find -type f -name \*.avi` echo 'we will be using ' $INPUTFILE 'as input videofile' OUTPUTSTACK=`${INPUTFILE%.avi}` OUTPUTFILE=`echo $OUTPUTSTACK '.mkv'` echo 'The output videofile will be ' $OUTPUTFILE ffmpeg -i $INPUTFILE -vcodec ffv1 -acodec pcm_s16le $OUTPUTFILE
I have a verry basic knowledge of scripting and tried to check for alternative ways but can't see why it outputs that way.Code:export NAMELENGTH=`expr length $INPUTFILE` export OUTPUTLENGTH=`expr $NAMELENGTH - 5` export OUTPUTFILE=`${INPUTFILE:2:OUTPUTLENGTH}`
anyone able to help?
thanks
- 10-11-2011 #2Just Joined!
- Join Date
- Mar 2007
- Location
- Bogotá, Colombia
- Posts
- 39
Hello!
Well, I would use sed to change the extensio of your file.
check this out:
if you already have the original name, it is very simple to change the extension of it with sed.Code:A=myfile.avi ; B=`echo $A | sed -r 's/\.avi$/\.mkv/'` ; echo $A $B
I hope it helps.
- 10-11-2011 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
To convert an avi file (avi is just a wrapper for other protocols, such as mp4) to an mkv file, you need to transcode it with a tool such as ffmpeg, which will do this in a streaming manner as you want. Here is a link to the ffmpeg web site: FFmpeg
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote