0

How do i run this file

infile ="video.avi"
tmpfile="video_tmp.mp4"
outfile="video.mp4"
options="-vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \
   -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \
   -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \
   -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \
         -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\
   -qmax 51 -qdiff 4"

ffmpeg -y -i "$infile" -an -pass 1 -threads 2 $options "$tmpfile"

ffmpeg -y -i "$infile" -acodec libfaac -ar 44100 -ab 96k -pass 2 -threads 2 $options "$tmpfile"

qt-faststart "$tmpfile" "$outfile"

Taken from here https://gist.github.com/vadimii/4621929

Shell commands is well out of my scope any help would be appreciated thanks

8
  • Save, chmod +x script and ./script Commented Oct 11, 2013 at 12:32
  • it is a shell script - save it to a file and then execute it using your shell interpreter e.g. bash file.sh Commented Oct 11, 2013 at 12:35
  • so the command would just be ./file video_one.mov output.mp4 Commented Oct 11, 2013 at 12:40
  • It is not taking any parameter, so just ./file is enough. To have one parameter, use infile=$1 and then execute with ./file video_one.... In general, try to ask more clearly so we can know what you exactly want to do with this script. Commented Oct 11, 2013 at 12:41
  • sorry i have ffmpeg installed and i am just trying to encode for H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps and i ended up at this script so i am trying to get it to run. Commented Oct 11, 2013 at 12:45

1 Answer 1

1

Based on what has been written in comments:

infile =$1
tmpfile="video_tmp.mp4"
outfile=$2
options="-vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \
   -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \
   -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \
   -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \
         -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\
   -qmax 51 -qdiff 4"

ffmpeg -y -i "$infile" -an -pass 1 -threads 2 $options "$tmpfile"

ffmpeg -y -i "$infile" -acodec libfaac -ar 44100 -ab 96k -pass 2 -threads 2 $options "$tmpfile"

qt-faststart "$tmpfile" "$outfile"

To execute it:

  • Save this file as let's say my_script.
  • Give it executing permissions: chmod +x my_script.
  • Execute it givin parameters as follows:

    ./my_script input_file output_file
    

or

/bin/bash my_script input_file output_file
Sign up to request clarification or add additional context in comments.

2 Comments

thanks that run it but i get the error : No such file or directory last atom in file was not a moov atom i think ill try find a good gui
If you are adding the parameters without its path, make sure they are in the same path of the script. Otherwise, put their full path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.