thank you for this.
I placed this in the existing script.
When i start the script indeed it asks me to restart, shutdown or Leave computer on.�
When i give in R S or L the script starts converting the movies as it needs to do
after all the converting is done i get following output:
Finished. Shutting down.
sudo /sbin/poweroff
koen@Koen-PC ~/Downloads/test $
so it says its going to shutdown (or restart or just quit)
it echo's the command to shutdown or restart or exit
but it does not do the work, it comes back to commandprompt
---------- Post updated at 05:35 PM ---------- Previous update was at 05:01 PM ----------
To clarify previous post, this is the used script:
#!/bin/sh
RESTART=""
while true
do
case "$RESTART" in
[RrSslL])
break;
;;
*) echo "(R)estart, (S)hut down, (L)eave computer on?"
read RESTART
;;
esac
done
echo "do stuff"
sleep 2
echo "CPSP 1.3"
echo "Converting movies (.avi) to .MP4 for PlayStation Portable."
echo ""
echo "Files must be named as M4V00001.avi (adjust 00001 to 00002, 00003, ... for multiple files."
echo ""
echo "Original: fakap mp3-to-flv converter http://staff.fakap.net/mp3toflv/"
echo "Special thanks to dude2cool and Corona688 @ http://www.unix.com/ for helping to put the script together"
if [ $# -eq 0 ]
then
echo "Input files: *.avi"
echo "Output files: *.MP4"
fi
while [ $# -ne 0 ]
do
newext=$(echo "$1"|sed 's/\.avi//g')
ffmpeg -i $1 -f psp -r 29.97 -b 512k -ar 24000 -ab 64k -s 320x240 "$newext".MP4
shift
done
echo ""
echo "CPSP has finished converting the files."
echo "Thank you for using CPSP 1.3"
echo "bye bye"
echo ""
case "$RESTART" in
[rR]) echo "Finished. Rebooting."
echo sudo /sbin/reboot
;;
[sS]) echo "Finished. Shutting down."
echo sudo /sbin/poweroff
;;
[lL]) echo "Finished. Quitting."
exit 0
;;
*) echo "How'd this get here?"
;;
esac
This is the output i get:
koen@Koen-PC ~/Downloads/test $ ./CPSP.sh *.avi
(R)estart, (S)hut down, (L)eave computer on?
r
do stuff
CPSP 1.3
Converting movies (.avi) to .MP4 for PlayStation Portable.
Files must be named as M4V00001.avi (adjust 00001 to 00002, 00003, ... for multiple files.
Original: fakap mp3-to-flv converter http://staff.fakap.net/mp3toflv/
Special thanks to dude2cool and Corona688 @ http://www.unix.com/ for helping to put the script together
FFmpeg version 0.6.2-4:0.6.2-1ubuntu1, Copyright (c) 2000-2010 the Libav developers
built on Mar 22 2011 15:35:22 with gcc 4.5.2
...
...
Some info about ffmpeg (cutted to save some space)
...
...
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, avi, from 'dmd-nda-sample.avi':
Duration: 00:01:29.71, start: 0.000000, bitrate: 2630 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 624x352 [PAR 1:1 DAR 39:22], 23.98 tbr, 23.98 tbn, 23.98 tbc
Stream #0.1: Audio: mp3, 48000 Hz, 2 channels, s16, 128 kb/s
Output #0, psp, to 'dmd-nda-sample.MP4':
Metadata:
encoder : Lavf52.64.2
Stream #0.0: Video: mpeg4, yuv420p, 320x240 [PAR 117:88 DAR 39:22], q=2-31, 512 kb/s, 2997 tbn, 29.97 tbc
Stream #0.1: Audio: aac, 24000 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
[mpeg4 @ 0x9ff9680]Invalid and inefficient vfw-avi packed B frames detected
frame= 7 fps= 4 q=2.0 size= 18kB time=0.23 bitrate= 630.2kbits/s dup=1 frame= 17 fps= 8 q=2.0 size= 50kB time=0.57 bitrate= 721.1kbits/s dup=3 frame= 27 fps= 10 q=2.0 size= 72kB time=0.90 bitrate= 653.2kbits/s dup=5 frame= 41 fps= 13 q=2.0 size= 96kB time=1.37 bitrate= 574.1kbits/s dup=8 frame= 54 fps= 14 q=2.0 size= 139kB time=1.80 bitrate= 632.1kbits/s dup=11frame= 76 fps= 18 q=2.0 size= 208kB time=2.54 bitrate= 670.5kbits/s dup=15frame= 86 fps= 18 q=2.0 size= 247kB time=2.87 bitrate= 703.8kbits/s dup=17frame= 96 fps= 18 q=2.5 size= 277kB
...
...
...
A bunch of converting steps
...
...
...
74 fps= 14 q=14.0 size= 6398kB time=89.22 bitrate= 587.5kbits/s dup=frame= 2689 fps= 14 q=14.9 Lsize= 6478kB time=89.72 bitrate= 591.4kbits/s dup=538 drop=0
video:5778kB audio:660kB global headers:0kB muxing overhead 0.617032%
CPSP has finished converting the files.
Thank you for using CPSP 1.3
bye bye
Finished. Rebooting.
sudo /sbin/reboot
koen@Koen-PC ~/Downloads/test $