Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #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:
    we will be using  dexterS6E2.avi as input videofile
    ./ line 4: dexterS6E2: No such file or directory

    INPUTFILE=`find -type f -name \*.avi`
    echo 'we will be using ' $INPUTFILE 'as input videofile'
    echo 'The output videofile will be ' $OUTPUTFILE 
    ffmpeg -i $INPUTFILE -vcodec ffv1 -acodec pcm_s16le $OUTPUTFILE
    I have also tried to use the expr lengt and results in the same output
    export NAMELENGTH=`expr length $INPUTFILE`
    export OUTPUTLENGTH=`expr $NAMELENGTH - 5`
    I have a verry basic knowledge of scripting and tried to check for alternative ways but can't see why it outputs that way.

    anyone able to help?


  2. #2
    Just Joined!
    Join Date
    Mar 2007
    Bogotá, Colombia

    Well, I would use sed to change the extensio of your file.

    check this out:

    A=myfile.avi ; B=`echo $A | sed -r 's/\.avi$/\.mkv/'` ; echo $A $B
    if you already have the original name, it is very simple to change the extension of it with sed.

    I hope it helps.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    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!

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts