Difference between revisions of "Schrodinger"
Jwmaseberg (talk | contribs) |
Jwmaseberg (talk | contribs) |
||
Line 17: | Line 17: | ||
sudo apt-get install ffmpeg libavcodec-extra-53 | sudo apt-get install ffmpeg libavcodec-extra-53 | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | Scripts for making a movie from still photos: | ||
+ | (note-- to make a bash script executable do sudo chmod a+x filename.sh) | ||
+ | |||
+ | #rename.sh | ||
+ | #!/bin/sh | ||
+ | |||
+ | if [ $# -ne 1 ] ; then | ||
+ | echo "Usage: $(basename $0) subdirectory (with pictures)" | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | dir="$1" | ||
+ | pattern="pic_" | ||
+ | count="1" | ||
+ | |||
+ | for filename in $(ls $dir*) | ||
+ | do | ||
+ | new=`printf "%04d" $count` | ||
+ | newname="$pattern$new.jpg" | ||
+ | filename="$(echo $filename | sed 's/__/ /g')" | ||
+ | echo "renaming \"$filename\" to $newname" | ||
+ | mv $dir/"$filename" $dir/"$newname" | ||
+ | count=$(( $count + 1 )) | ||
+ | done | ||
+ | |||
+ | exit 0 | ||
+ | |||
+ | |||
+ | #resize.sh | ||
+ | #!/bin/sh | ||
+ | |||
+ | if [ $# -ne 1 ] ; then | ||
+ | echo "Usage: $(basename $0) subdirectory (with pictures)" | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | dir="$1" | ||
+ | |||
+ | for filename in $(ls $dir*) | ||
+ | do | ||
+ | filename="$(echo $filename | sed 's/__/ /g')" | ||
+ | echo "resizing \"$filename\" to $filename" | ||
+ | convert $dir/"$filename" -resize 1440x1080 $dir/"$filename" | ||
+ | # convert $dir/"$filename" -gravity center -background black -extent 1920x1080 $dir/"$filename" | ||
+ | done | ||
+ | |||
+ | exit 0 | ||
+ | |||
+ | |||
+ | #makemovie.sh | ||
+ | #!/bin/sh | ||
+ | |||
+ | if [ $# -ne 1 ] ; then | ||
+ | echo "Usage: $(basename $0) subdirectory (with pictures)" | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | dir="$1" | ||
+ | |||
+ | ffmpeg -r 0.390 -i $dir/pic_%04d.jpg -aspect 1440:1080 -vcodec libx264 -crf 1 -vpre lossless_slower -y -r 24000/1001 video.mp4 | ||
+ | # -r 0.4 means 0.4 frames per second, or 2.5 seconds per frame | ||
+ | # you can put another -r 30 near the end to specify 30fps video | ||
+ | # the -crf (constant rate factor) option means 1 pass encoding and is related to bitrate, 15 is higher quality than 24, ommiting seems to default to 0 which is highest quality | ||
+ | |||
+ | #if you have jpg files from diffenent cameras that are causing problems, try: | ||
+ | #identify -verbose *.jpg make sure that the geometry and resolution are the same for all images! | ||
+ | #mogrify -format bmp *, then rm *.jpg, then mogrify -format jpg *, then rm *.bmp | ||
+ | |||
+ | #to add an audio track you can do: | ||
+ | #ffmpeg -i track.aac -i video.mp4 -acodec copy -vcodec copy videowsound.mp4 | ||
+ | #make audio track with: | ||
+ | #ffmpeg -i track.mp3 -acodec libfaac -aq 255 -ar 44100 -ac 2 track.aac | ||
+ | exit 0 | ||
+ | |||
+ | |||
+ | #sound.sh | ||
+ | #!/bin/sh | ||
+ | #to add an audio track you can do: | ||
+ | ffmpeg -i track.aac -i video.mp4 -acodec copy -vcodec copy videowsound.mp4 | ||
+ | #to convert mp3 to aac try | ||
+ | #ffmpeg -i track.mp3 -acodec libfaac -aq 255 -ar 44100 -ac 2 track.aac | ||
+ | exit 0 |
Revision as of 14:51, 18 January 2012
Authors: Aaron Brown and Jack Maseberg
Goal: We wish to solve the time-dependent Schrodinger equation in 2 dimensions (using gfortran) and plot our still images of the wavefunction with POV-ray to make an animated movie!
Step 1) Install Xubuntu 11.10 “Oneiric Ocelot” (dual booting: it's easiest to have windows installed and free drive space, then just install Xubuntu onto the free drive space).
Step 2) Use the Synaptic package manager to install gfortran(4.6.1-9ubuntu3). Use the Synaptic package manager to instlal povray(3.6.1). Use the Synaptic package manager to install imagemagick. Use the Synaptic package manager to install vlc.
Ffmpeg:
sudo wget http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list --output-document=/etc/apt/sources.list.d/medibuntu.list && sudo apt-get -q update && sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring && sudo apt-get -q update
sudo apt-get install ffmpeg libavcodec-extra-53
Scripts for making a movie from still photos:
(note-- to make a bash script executable do sudo chmod a+x filename.sh)
- rename.sh
- !/bin/sh
if [ $# -ne 1 ] ; then
echo "Usage: $(basename $0) subdirectory (with pictures)" exit 1
fi
dir="$1" pattern="pic_" count="1"
for filename in $(ls $dir*) do
new=`printf "%04d" $count` newname="$pattern$new.jpg" filename="$(echo $filename | sed 's/__/ /g')" echo "renaming \"$filename\" to $newname" mv $dir/"$filename" $dir/"$newname" count=$(( $count + 1 ))
done
exit 0
- resize.sh
- !/bin/sh
if [ $# -ne 1 ] ; then
echo "Usage: $(basename $0) subdirectory (with pictures)" exit 1
fi
dir="$1"
for filename in $(ls $dir*) do
filename="$(echo $filename | sed 's/__/ /g')" echo "resizing \"$filename\" to $filename" convert $dir/"$filename" -resize 1440x1080 $dir/"$filename"
- convert $dir/"$filename" -gravity center -background black -extent 1920x1080 $dir/"$filename"
done
exit 0
- makemovie.sh
- !/bin/sh
if [ $# -ne 1 ] ; then
echo "Usage: $(basename $0) subdirectory (with pictures)" exit 1
fi
dir="$1"
ffmpeg -r 0.390 -i $dir/pic_%04d.jpg -aspect 1440:1080 -vcodec libx264 -crf 1 -vpre lossless_slower -y -r 24000/1001 video.mp4
- -r 0.4 means 0.4 frames per second, or 2.5 seconds per frame
- you can put another -r 30 near the end to specify 30fps video
- the -crf (constant rate factor) option means 1 pass encoding and is related to bitrate, 15 is higher quality than 24, ommiting seems to default to 0 which is highest quality
- if you have jpg files from diffenent cameras that are causing problems, try:
- identify -verbose *.jpg make sure that the geometry and resolution are the same for all images!
- mogrify -format bmp *, then rm *.jpg, then mogrify -format jpg *, then rm *.bmp
- to add an audio track you can do:
- ffmpeg -i track.aac -i video.mp4 -acodec copy -vcodec copy videowsound.mp4
- make audio track with:
- ffmpeg -i track.mp3 -acodec libfaac -aq 255 -ar 44100 -ac 2 track.aac
exit 0
- sound.sh
- !/bin/sh
- to add an audio track you can do:
ffmpeg -i track.aac -i video.mp4 -acodec copy -vcodec copy videowsound.mp4
- to convert mp3 to aac try
- ffmpeg -i track.mp3 -acodec libfaac -aq 255 -ar 44100 -ac 2 track.aac
exit 0