LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-05-2014, 11:04 AM   #1
Byenary
Member
 
Registered: Oct 2003
Distribution: edgy dapper feisty
Posts: 36

Rep: Reputation: 15
Question Script / software to create lightversion of video's


Hi,

Got bunch of videos organized in folder stuctures, these are high res and the wifi and tablet can't handle the size
So I'm looking for a script that loops trough the directory and create a copy of all files and downscaling them.
I'm able to sort out the ffmpeg command, but not sure about the rest of the script (looping trough all files and recreate directory and process troug ffmpeg if not existant on destination.

Lots of thx and Happy NewYear
 
Old 01-06-2014, 09:42 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
Have a look at this example:
Code:
#!/bin/bash

while read inFile
do
  outName="${inFile%.*}"                    # name part
  outExt="${inFile##*.}"                    # extension part
  outFile="${outName}.downscaled.${outExt}" # new name for outfile

  # only do this when outfile does not exist
  [[ -a "${outFile}" ]] || echo ffmpeg -i "${inFile}" ..... "${outFile}"
done < <( find . -type f -print )
This will create the new file(s) in the same directory as the original, but the name of the output file is changed: movie.avi -> movie.downscaled.avi

The find .... part looks for all files from where the command is executed. You might want to change this to a full path: find /path/to/first/movie/dir -type f -print

The above only echo's the ffmpeg command and does not execute it (remove the echo and edit the command to your needs).

This is just a rough example and might need some tweaking to meet your specific needs.
 
1 members found this post helpful.
Old 01-06-2014, 10:55 AM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,150

Rep: Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887Reputation: 887
this is my modified xvidenc output:
Code:
schneidz@xbmc:~$ cat bin/xvidenc-ac3-mkv.ksh 
#!/bin/bash
################### START OF COMMANDS ###################
dvd=`lsdvd $1 | grep "Disc Title:" | awk '{print tolower($3)}' | sed s/_/-/g`
#mkdir /home/xbmc/win/stuff/clips/$dvd
titles=`lsdvd $1 | grep ^Title: | cut -b 8-9 | tail -n 1`
i=1
if [ -n "$2" ]
then
 i=$2
 titles=$2
fi

while [ $i -le $titles ]
do

/usr/bin/mencoder "dvd://$i" -nosub -dvd-device $1 -o /dev/null -vf pp=al:c,softskip,unsharp=l5x5:.25:c5x5:.25,harddup -aid 128 -channels 6 -oac lavc -lavcopts acodec=ac3:abitrate=192 -a52drc 1 -ovc xvid -xvidencopts pass=1:turbo:me_quality=6:vhq=4:threads=2:max_bframes=2:bvhq=1:nopacked:quant_type=h263:noqpel:nogmc:trellis:nointerlacing:chroma_me:chroma_opt:hq_ac:nolumi_mask:rc_reaction_delay_factor=0:rc_averaging_period=100:closed_gop:autoaspect -passlogfile "$dvd-`zero-pad-2.x $i`.log"

/usr/bin/mencoder "dvd://$i" -nosub -dvd-device $1 -o "$dvd-`zero-pad-2.x $i`".avi -ffourcc XVID -vf pp=al:c,softskip,unsharp=l5x5:.25:c5x5:.25,harddup -aid 128 -channels 6 -oac lavc -lavcopts acodec=ac3:abitrate=192 -a52drc 1 -ovc xvid -xvidencopts pass=2:bitrate=1000:me_quality=6:vhq=4:threads=2:max_bframes=2:bvhq=1:nopacked:quant_type=h263:noqpel:nogmc:trellis:nointerlacing:chroma_me:chroma_opt:hq_ac:nolumi_mask:rc_reaction_delay_factor=0:rc_averaging_period=100:closed_gop:autoaspect -passlogfile "$dvd-`zero-pad-2.x $i`.log"

sleep 2

/usr/bin/mkvmerge   --title "$dvd-$title-ac3" --track-name 0:"$dvd-$title-ac3" --language 1:en --track-name 1:"AC3 5.1" "$dvd-`zero-pad-2.x $i`.avi"      -o "$dvd-`zero-pad-2.x $i`.mkv"
sleep 2
rm "$dvd-`zero-pad-2.x $i`.avi" "$dvd-`zero-pad-2.x $i`.log"
i=`expr $i + 1`
done
#################### END OF COMMANDS ####################
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Script question: create a shell script in kde to log in on a server with ssh c4719929 Linux - Newbie 1 01-31-2011 04:05 AM
LXer: Create Software Using Illumination Software Creator Without having Skills LXer Syndicated Linux News 0 10-26-2010 04:50 AM
software to create a video of waves from an audio file eantoranz Linux - Software 2 10-25-2010 11:44 AM
Bash Script Help - Trying to create a variable inside script when run. webaccounts Linux - Newbie 1 06-09-2008 03:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration