Thursday, 3 July 2014

Linux command is used to find and Convert all *.wmv extension to *.mp4 file format

Basics :
             Note: the file name should not contain any space please replace space with _ underscore ;       
       
        1) Finding File

                root@ubuntu:$ find . -name "*.wmv" used to list all the files
      
        2) Executing command with find result

                -exec <linux command to execute > \; is used to execute the command ;
      
        3) FFmpeg Conversion:
             
ffmpeg -i <input_file_name.wmv> -strict experimental -acodec aac -vcodec libx264 <output_file_name.mp4>
      
        4)
For Renaming files
                rename 's/.abc$/.edefg/' *.abc
       
           So Lets Start converting Files :

          your command Should be like this :
           
        Step 1: For Video Conversion (wmv to mp4) :
       
            find . -name "*.wmv" -exec ffmpeg -i {} -strict experimental -acodec aac -vcodec libx264 {}.mp4 \;

        Note:
               The above command start converting and saving file in same location
                eg:  original file : test.wmv   converted file : test.wmv.mp4

        Step 2: Renaming Files
       
            find . -name "*.wmv.mp4" -print0 | xargs -0 rename 's/.wmv.mp4$/.mp4/'

       Note:
                The above command used to rename files from test.wmv.mp4 to test.mp4

Author,
Kanth Anand

No comments:

Post a Comment