What to do with .flv files?
Simon
simon80-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Wed Nov 29 23:56:01 UTC 2006
You're joking, right? all three functions can be replaced with
"`printf %.3d $i`.flv";((++i));
In the spirit of free software, I cleaned up the script. It's also
attached, since GMail likes to mangle my text.
#!/bin/bash
# This script can be run from anywhere and will output a directory in the
# current folder full of flash files. If the first argument is -t, it will also
# transcode them all using ffmpeg2theora as a bonus.
CURDIR=`pwd`;
OUTDIR="$CURDIR/CachedFlashFiles";
mkdir -p $OUTDIR;
# change to cache dir by assuming that there's only one directory in the firefox
# dir, but we don't know what it is, so cd to the first directory we can find
# and hope it has a Cache folder in it
for file in ~/.mozilla/firefox/*; do
if [ -d $file ]; then
cd $file/Cache || { echo "I screwed up, change to your Cache
directory and run this again for better results. Press ctrl-c to kill
the script
now unless you're aready in the desired directory." && sleep 5; }
break;
fi;
done
i=1;
for file in *; do
if echo "`file ${file}`" | grep "Macromedia Flash Video" > /dev/null ; then
cp ${file} $OUTDIR/"`printf %.3d $i`.flv";
((++i));
fi
done
if [ "x-t" == "x$1" ]; then
cd $OUTDIR;
for file in $OUTDIR/*.flv; do
ffmpeg2theora "$file";
done
fi
cd $CURDIR;
On 11/27/06, Walter Dnes <waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org> wrote:
> On Thu, Nov 23, 2006 at 03:57:38PM -0500, Daniel Armstrong wrote
>
> > I use the 'youtube-dl' script to download the videos:
> >
> > http://enterprise.linux.com/article.pl?sid=06/08/11/197251&tid=47
>
> I have my own version that is foolproof, no matter what the website
> does to block it. You see, Firefox creates a temporary file in its
> Cache directory, and hands that off to Flash to play. The file is left
> in the Cache folder after playing. I play a bunch of Youtube or
> video.google.com files as per normal. Then, from a console commandline,
> I cd to the cache directory and execute the following script which I
> call "getflv". Warning... contains backtick expandos; You don't know
> me, so verify for your self that it's harmless. The script scans
> through all the files in the currecnt directory (I did say to cd to the
> Cache dir), and any files that are determined to be flv get renamed to
> w.000.flv, w.001.flv, w.002.flv, etc.
>
> =======================================================================
> #!/bin/bash
>
> decrement() {
> echo $(( $1 - 1 ))
> }
>
> increment() {
> echo $(( $1 + 1 ))
> }
>
> getnextversion() {
> NUMBER=
> DIGITPOINTER=0
> while [ ${DIGITPOINTER} -lt ${1} ]
> do
> NUMBER=${NUMBER}0
> DIGIT[${DIGITPOINTER}]=0
> DIGITPOINTER=`increment ${DIGITPOINTER}`
> done
> while [ -e ${2}${NUMBER}${3} ]
> do
> DIGITPOINTER=`decrement ${1}`
> DIGITPNTLEFT=`decrement ${DIGITPOINTER}`
> DIGIT[${DIGITPOINTER}]=`increment ${DIGIT[${DIGITPOINTER}]}`
> NUMBER=
> while [ ${DIGITPOINTER} -ge 0 ]
> do
> if [ ${DIGIT[${DIGITPOINTER}]} -eq 10 ]
> then
> DIGIT[${DIGITPOINTER}]=0
> if [ ${DIGITPNTLEFT} -gt 0 ]
> then
> DIGIT[${DIGITPNTLEFT}]=`increment ${DIGIT[${DIGITPNTLEFT}]}`
> fi
> fi
> NUMBER=${DIGIT[${DIGITPOINTER}]}${NUMBER}
> DIGITPOINTER=${DIGITPNTLEFT}
> DIGITPNTLEFT=`decrement ${DIGITPNTLEFT}`
> done
> done
> echo ${2}${NUMBER}${3}
> }
>
> for filename in *
> do
> if echo "`file ${filename}`" | grep "Macromedia Flash Video" ; then
> newfilename=`getnextversion 3 w. .flv`
> mv ${filename} ${newfilename}
> echo ${newfilename}
> fi
> done
> =======================================================================
>
> You can inspect and move all the w.???.flv files to wherever.
>
> > ...and ffmpeg converts the *.flv files to *.avi files:
> >
> > ffmpeg -i <file>.flv <file>.avi
>
> mplayer handles it just find, as long as you remember to close the
> browser (you can re-open it if you want). Flash doesn't close the audio
> device after finishing... idiots.
>
> --
> Walter Dnes <waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org> In linux /sbin/init is Job #1
> My musings on technology and security at http://techsec.blog.ca
> --
> The Toronto Linux Users Group. Meetings: http://gtalug.org/
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getflashfiles.sh
Type: application/x-sh
Size: 1786 bytes
Desc: not available
URL: <http://gtalug.org/pipermail/legacy/attachments/20061129/21bf0be9/attachment.sh>
More information about the Legacy
mailing list