I have a file with a single filename in it, which I want to assign to a BASH variable, so I've been trying:
c=$(head -1 somefile)
echo $c
which outputs correctly, but them when I do
...
somecommand $c
it says it can't find the file, is that because it's grabbing the whole line, and how should I be doing it different, grep maybe?
whats that somecommand?? and is that file available on the dir where you are running that script??
#!/bin/bash
c=$(head -1 toconvertfile)
ffmpeg -i $c -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $c.tempfile
ffmpeg -i $c -acodec libfaac -ab 64k -pass 2 -vcodec libx264 -vpre hq -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $c.flv
rm $c.tempfile
ffmpeg -i $c.flv -s 174x116 -an -ss 5 -vframes 1 -f image2 -y $c.flv.jpg
#: cat toconvertfile
test1.avi
#: ls test1.*
test1.avi
if I just use
#!/bin/bash
ffmpeg -i $1 -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $1.tempfile
ffmpeg -i $1 -acodec libfaac -ab 64k -pass 2 -vcodec libx264 -vpre hq -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $1.flv
rm $1.tempfile
ffmpeg -i $1.flv -s 174x116 -an -ss 5 -vframes 1 -f image2 -y $1.flv.jpg
with
#: ./conv.sh test1.avi
it works
can you post the out put of
cat -vet toconvertfile
c=$(head -1 toconvertfile)
echo "$c"|cat -vet
echo "$c"
# cat -vet toconvertfile
test1.avi$
# c=$(head -1 toconvertfile)
# echo "$c"|cat -vet
test1.avi$
t# echo "$c"
test1.avi
okay, well I got it to work, thanks for the help, the final code is this:
#!/bin/bash
while [ 1 = 1 ]
do
c=$(head -1 toconvertfile)
for i in $c
do
ffmpeg -i $c -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $c.tempfile
ffmpeg -i $c -acodec libfaac -ab 64k -pass 2 -vcodec libx264 -vpre hq -b 512000 -bt 512000 -threads 0 -s 600x400 -r 30 -f flv $c.flv
ffmpeg -i $c.flv -s 174x116 -an -ss 5 -vframes 1 -f image2 -y $c.flv.jpg
rm $c.tempfile
cat /dev/null > toconvertfile
done
sleep 30
done