LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 10: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, 08:42 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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, 09:55 AM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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



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 03:05 AM
LXer: Create Software Using Illumination Software Creator Without having Skills LXer Syndicated Linux News 0 10-26-2010 03:50 AM
software to create a video of waves from an audio file eantoranz Linux - Software 2 10-25-2010 10:44 AM
Bash Script Help - Trying to create a variable inside script when run. webaccounts Linux - Newbie 1 06-09-2008 02:40 PM

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

All times are GMT -5. The time now is 07:14 AM.

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
Open Source Consulting | Domain Registration