bala150985

Compressing Large video files

Jun 28th, 2015
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.97 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. pwdir=`pwd`
  4.  
  5. ls -ltrh *.mp4 | awk {'print $9'} | grep -v onverted | sed "s/^/$(pwdir;)/g" > /tmp/video.txt
  6.  
  7. while read video
  8. do
  9.   rota=`exiftool $video | grep Rotat | cut -d: -f2 | tr -d " "`
  10.   echo "The value of Rotation in Filed using exiftool is $rota"
  11.  
  12.   if [ $rota -gt 0 ]; then
  13.     rotatevalue=`echo -n vfilter=rotate,scale=Auto`
  14.   else
  15.     rotatevalue=`echo -n scale=Auto`
  16.   fi
  17.  
  18.   outputvideo=`echo $video | sed 's/$pwdir//'`
  19.   echo "vlc -I dummy $video \":sout=#transcode{vcodec=h264,$rotatevalue}:std{access=file{no-overwrite},mux=mp4,dst='/tmp/Converted_$outputvideo'}\" vlc://quit" | sh
  20.   mv /tmp/Converted_$outputvideo $pwdir
  21.  
  22.   if [ -d $pwdir/orig ]; then
  23.      echo "Your original video will be pushed here"
  24.      mv $video $pwdir/orig/
  25.   else
  26.      echo "Now creating the Original Folder"
  27.      echo "Your original video will be pushed here $pwdir"
  28.      mkdir $pwdir/orig
  29.      mv $video $pwdir/orig/
  30.   fi
  31.      
  32. done < /tmp/video.txt
Advertisement
Add Comment
Please, Sign In to add comment