What to do with .flv files?

Walter Dnes waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org
Tue Nov 28 01:10:00 UTC 2006


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





More information about the Legacy mailing list