#1 23-03-2008 19:11:07

bob031
Modérateur
LinuxFirefox

Télécharger vidéos flash youtube et conversion avec ffmpeg

Télécharger vidéos flash youtube et conversion avec ffmpeg

L'idée est de récupérer des vidéos youtube sur son pc !

Oui mais comment ?

Tout simplement à l'aide d'une petit script que vous trouverez ici :
http://www.arrakis.es/~rggi3/youtube-dl/

Le script, vous l'avez compris, se nomme youtube-dl !
Vous le trouverez en bas de la page sous le doux nom de : 2008.03.22

Faire un clic-droit avec la souris dessus et faire "enregistrer la cible du lien vers".
On télécharge ainsi un fichier qui porte le nom de youtube-dl.htm (ben oui, c'est comme ça qu'il a été téléchargé).
Il suffit alors de faire :

[redfox@fedora8 Bureau]$ mv youtube-dl.htm youtube-dl

[redfox@fedora8 Bureau]$ md5sum youtube-dl
a86bfb24c5f9b7aff0c4ec2975c1a03c  youtube-dl

[redfox@fedora8 Bureau]$ chmod 744 youtube-dl

[root@fedora8 Bureau]# mv youtube-dl /usr/bin/


on fait un essai en récupérant une vidéo :

[redfox@fedora8 Bureau]$ youtube-dl -t http://www.youtube.com/watch?v=Yl8qfu-ojTQ
Retrieving video webpage... done.
Extracting video title... done.
Extracting URL "t" parameter... done.
Requesting video file... done.
Video data found at http://nyc-v135.nyc.youtube.com/get_vid … yt1&sver=2
Retrieving video data: 100.0% (  11.74M of 11.74M) at   43.68k/s ETA 00:00 done.
Video data saved to making_a_trumpet-Yl8qfu-ojTQ.flv
[redfox@fedora8 Bureau]$

ensuite j'ouvre VLC par exemple, puis "ouvrir un fichier" et choisir le fichier portant le nom de :
making_a_trumpet-Yl8qfu-ojTQ.flv

....ça marche !!!!


un pinguin sur la banquise !

Hors ligne

#2 23-03-2008 20:39:48

bob031
Modérateur
LinuxFirefox

Re: Télécharger vidéos flash youtube et conversion avec ffmpeg

(suite)

usage :

[redfox@fedora8 Bureau]$ youtube-dl --help
Usage: youtube-dl [options] video_url

Options:
  -h, --help            print this help text and exit
  -v, --version         print program version and exit
  -u USERNAME, --username=USERNAME
                        account username
  -p PASSWORD, --password=PASSWORD
                        account password
  -o FILE, --output=FILE
                        output video file name
  -q, --quiet           activates quiet mode
  -s, --simulate        do not download video
  -t, --title           use title in file name
  -l, --literal         use literal title in file name
  -n, --netrc           use .netrc authentication data
  -g, --get-url         print final video URL only
  -2, --title-too       used with -g, print title too
  -f FORMAT, --format=FORMAT
                        append &fmt=FORMAT to the URL
  -b, --best-quality    alias for -f 18
[redfox@fedora8 Bureau]


Conversion flash videos vers MPEG-4 :

copier le script suivant :

Code:

#!/bin/sh 

if [ -z "$1" ]; then
  echo "Usage: $0 {-divx|-xvid} list_of_flv_files"
  exit 1
fi

# video encoding bit rate
V_BITRATE=1000

while [ "$1" ]; do
  case "$1" in
    -divx)
      MENC_OPTS="-ovc lavc -lavcopts \
        vcodec=mpeg4:vbitrate=$V_BITRATE:mbd=2:v4mv:autoas  pect"
      ;;
    -xvid)
      MENC_OPTS="-ovc xvid -xvidencopts bitrate=$V_BITRATE:autoaspect"
      ;;
    *)
      if file "$1" | grep -q "Macromedia Flash Video"; then
        mencoder "$1" $MENC_OPTS -vf pp=lb -oac mp3lame \
          -lameopts fast:preset=standard -o \
          "`basename $1 .flv`.avi"
      else
        echo "$1 is not Flash Video. Skipping"
      fi
      ;;
  esac
  shift
done

donc créer le fichier (vim par exemple) et y coller le texte ci-dessus :

[redfox@fedora8 Bureau]$ vi flv2avi.sh

[redfox@fedora8 Bureau]$ chmod 755 flv2avi.sh

[root@fedora8 Bureau]# mv flv2avi.sh /usr/bin/

[redfox@fedora8 Bureau]$ flv2avi.sh -xvid /home/redfox/Bureau/Rk40kvatWIA.flv
/usr/bin/flv2avi.sh: line 22: mencoder: command not found
[redfox@fedora8 Bureau]$

arghhhhhhhhhhh ! j'ai oublié d'installer mencoder (contenu dans ffmpeg)  ......à suivre


un pinguin sur la banquise !

Hors ligne

#3 24-03-2008 16:55:39

aruju
admin
DebianIceweasel

Re: Télécharger vidéos flash youtube et conversion avec ffmpeg

merci ca marche impec, en plus j'aime bien le choix de video que t'as choisi big_smile

Hors ligne

#4 24-03-2008 17:31:21

bob031
Modérateur
LinuxMozilla

Re: Télécharger vidéos flash youtube et conversion avec ffmpeg

c'est pas moi qui ait choisi !
j'ai pris le même exemple que le how-to ....


un pinguin sur la banquise !

Hors ligne

#5 01-05-2008 10:08:00

bob031
Modérateur
LinuxFirefox

Re: Télécharger vidéos flash youtube et conversion avec ffmpeg

bonjour,

à terminer :
"Conversion flash videos vers MPEG-4"

à voir :
"Downloading a youtube video and extracting only the audio" (télécharger une vidéo youtube et extraire seulement la bande audio).
source : http://forums.fedoraforum.org/forum/sho … ost1004121

également :
"Download Youtube videos with wget" (télécharger des vidéos youtube avec wget)
source : http://www.go2linux.org/wget-to-download-youtube-videos


un pinguin sur la banquise !

Hors ligne

#6 01-05-2008 12:55:11

bob031
Modérateur
LinuxFirefox

Re: Télécharger vidéos flash youtube et conversion avec ffmpeg

Conversion flash videos vers MPEG-4

l'extension sera .avi

If you would like to convert your flash videos to an open source MPEG-4 codec (libavcodec) you can use the -xvid option. The -xvid option refers to software that is used to encode MPEG-4 ASP video. Your new video file will have an .avi extension. The -divx option refers to proprietary based closed source software that is used to create an MPEG-4 codec.The file will also have an .avi extension.

source : http://forums.fedoraforum.org/forum/sho … p?t=184259


donc on installe ffmpeg

Code:

[root@fedora8 ~]# yum install ffmpeg
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package ffmpeg.i386 0:0.4.9-0.41.20071011.lvn8 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Installing:
 ffmpeg                  i386       0.4.9-0.41.20071011.lvn8  livna             188 k

Transaction Summary
=============================================================================
Install      1 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         

Total download size: 188 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): ffmpeg-0.4.9-0.41. 100% |=========================| 188 kB    00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: ffmpeg                       ######################### [1/1] 

Installed: ffmpeg.i386 0:0.4.9-0.41.20071011.lvn8
Complete!
[root@fedora8 ~]#

ensuite :

Code:

[redfox@fedora8 Bureau]$ youtube-dl -t http://www.youtube.com/watch?v=Yl8qfu-ojTQ
Retrieving video webpage... done.
Extracting video title... done.
Extracting URL "t" parameter... done.
Requesting video file... done.
Video data found at http://ash-v445.ash.youtube.com/get_video?video_id=Yl8qfu-ojTQ&signature=B111293E438ECA9C8656A33C4ACC3E2035BABDB4.114DF75C79DCEC34E28DFF4CE1EDD0E5AC17151C&ip=87.91.57.8&ipbits=16&expire=1209658520&key=yt1&sver=2
Retrieving video data: 100.0% (  11.74M of 11.74M) at  150.39k/s ETA 00:00 done.
Video data saved to making_a_trumpet-Yl8qfu-ojTQ.flv
[redfox@fedora8 Bureau]$

puis :

Code:

[redfox@fedora8 Bureau]$ flv2avi.sh -xvid making_a_trumpet-Yl8qfu-ojTQ.flv
/usr/bin/flv2avi.sh: line 22: mencoder: command not found

ok ! apparemment "mencoder" n'est pas inclus dans ffmpeg (j'ai semble-t-il dit une ânerie !).

pô grâve :

Code:

[redfox@fedora8 Bureau]$ ffmpeg -i making_a_trumpet-Yl8qfu-ojTQ.flv -ar 48000 -ac 2 /home/redfox/Bureau/making_a_trumpet.avi
FFmpeg version SVN-r10703, Copyright (c) 2000-2007 Fabrice Bellard, et al.
  configuration: --prefix=/usr --incdir=/usr/include/ffmpeg --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --arch=i386 --extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables --enable-liba52 --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libogg --enable-libtheora --enable-libvorbis --enable-libxvid --enable-libx264 --enable-pp --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-opts --disable-strip
  libavutil version: 49.5.0
  libavcodec version: 51.45.0
  libavformat version: 51.14.0
  built on Oct 18 2007 03:11:06, gcc: 4.1.2 20070925 (Red Hat 4.1.2-31)

Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)
Input #0, flv, from 'making_a_trumpet-Yl8qfu-ojTQ.flv':
  Duration: 00:05:00.0, start: 0.000000, bitrate: 56 kb/s
  Stream #0.0: Video: flv, yuv420p, 320x240, 25.00 fps(r)
  Stream #0.1: Audio: mp3, 22050 Hz, mono, 56 kb/s
Output #0, avi, to '/home/redfox/Bureau/making_a_trumpet.avi':
  Stream #0.0: Video: mpeg4, yuv420p, 320x240, q=2-31, 200 kb/s, 25.00 fps(c)
  Stream #0.1: Audio: mp2, 48000 Hz, stereo, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 7502 fps=258 q=11.4 Lsize=   10369kB time=300.0 bitrate= 283.2kbits/s    
video:7544kB audio:2344kB global headers:0kB muxing overhead 4.876258%
[redfox@fedora8 Bureau]$

et toc :

Code:

[redfox@fedora8 Bureau]$ [b]ls -l making*[/b]
-rw-rw-r-- 1 redfox redfox 10618074 mai  1 12:25 making_a_trumpet.avi
-rw-rw-r-- 1 redfox redfox 12311882 mai  1 12:16 making_a_trumpet-Yl8qfu-ojTQ.flv
[redfox@fedora8 Bureau]$

il 'y a plus qu'à ....


smile)


un pinguin sur la banquise !

Hors ligne

#7 01-05-2008 13:14:37

bob031
Modérateur
LinuxFirefox

Re: Télécharger vidéos flash youtube et conversion avec ffmpeg

alors ! avec mencoder ! on installe tout d'abord mencoder !

Code:

[root@fedora8 ~]# yum install mencoder
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package mencoder.i386 0:1.0-0.90.rc2.lvn8 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Installing:
 mencoder                i386       1.0-0.90.rc2.lvn8  livna             2.9 M

Transaction Summary
=============================================================================
Install      1 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         

Total download size: 2.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): mencoder-1.0-0.90. 100% |=========================| 2.9 MB    00:03     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: mencoder                     ######################### [1/1] 

Installed: mencoder.i386 0:1.0-0.90.rc2.lvn8
Complete!
[root@fedora8 ~]# 
[root@fedora8 ~]# 
[root@fedora8 ~]# 
[root@fedora8 ~]# 
[root@fedora8 ~]# exit
logout

[redfox@fedora8 Bureau]$

puis

Code:

[redfox@fedora8 Bureau]$ flv2avi.sh -xvid making_a_trumpet-Yl8qfu-ojTQ.flv 
MEncoder 1.0rc2-4.1.2 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Celeron(R) CPU 2.80GHz (Family: 15, Model: 4, Stepping: 1)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
success: format: 0  data: 0x0 - 0xbbdd4a
libavformat file format detected.
[lavf] Video stream found, -vid 0
[lavf] Audio stream found, -aid 1
VIDEO:  [FLV1]  320x240  0bpp  25.000 fps    0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:44  fourcc:0x31564C46  size:320x240  fps:25.00  ftime:=0.0400
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 22050 Hz, 2 ch, s16le, 8.0 kbit/1.13% (ratio: 1000->88200)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
xvid: using library version 1.1.3 (build xvid-1.1.3)
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [pp=lb]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffflv] vfm: ffmpeg (FFmpeg Flash video)
==========================================================================
MP3 audio selected.
VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12)
[PP] Using external postprocessing filter, max q = 6.
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
videocodec: XviD (320x240 fourcc=44495658 [XVID])
xvid: par=1/1 (ext), displayed=320x240, sampled=320x240
xvid: CBR Rate Control -- bitrate=1000kbit/s
New_Face failed. Maybe the font path is wrong.
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
Writing header...
ODML: vprp aspect is 4:3.
Setting audio delay to 0.052s.
Writing header...
ODML: vprp aspect is 4:3.
Setting audio delay to 0.052s.
Pos:   0.8s     22f ( 0%)  0.00fps Trem:   1min  10mb  A-V:0.084 [0:53]
Skipping frame!
Pos:   1.2s     32f ( 0%)  0.00fps Trem:   1min   9mb  A-V:0.084 [443:56]
Skipping frame!
Pos:   1.5s     42f ( 0%)  0.00fps Trem:   1min  12mb  A-V:0.084 [446:58]
Skipping frame!
Pos:   1.9s     52f ( 1%)  0.00fps Trem:   1min  11mb  A-V:0.084 [439:60]
Skipping frame!
Pos:   2.4s     66f ( 1%)  0.00fps Trem:   1min  15mb  A-V:0.081 [489:61]
Skipping frame!
Pos:  20.0s    508f ( 8%) 63.67fps Trem:   1min  22mb  A-V:0.082 [693:66]
Skipping frame!
Pos: 299.8s   7502f (99%) 71.50fps Trem:   0min  18mb  A-V:0.012 [451:73]]
Flushing video frames.
Writing index...
Writing header...
ODML: vprp aspect is 4:3.
Setting audio delay to 0.052s.

Video stream:  451.209 kbit/s  (56401 B/s)  size: 16911313 bytes  299.840 secs  7502 frames

Audio stream:   73.183 kbit/s  (9147 B/s)  size: 2743807 bytes  299.938 secs
[redfox@fedora8 Bureau]$

vérification :

Code:

[redfox@fedora8 Bureau]$ ls -l making*
-rw-rw-r-- 1 redfox redfox 10618074 mai  1 12:25 making_a_trumpet.avi
-rw-rw-r-- 1 redfox redfox 20123950 mai  1 13:03 making_a_trumpet-Yl8qfu-ojTQ.avi
-rw-rw-r-- 1 redfox redfox 12311882 mai  1 12:16 making_a_trumpet-Yl8qfu-ojTQ.flv
[redfox@fedora8 Bureau]$

finalement on aboutit au même résultat avec la commande "ffmpeg" ou avec le script "flv2avi.sh" bien que les tailles des fichiers créés diffèrent sensiblement selon les 2 méthodes.
les 2 fichiers "avi" sont lus sans problème avec Rhythmbox 0.11.3 et Totem.


un pinguin sur la banquise !

Hors ligne

#8 01-05-2008 14:03:05

bob031
Modérateur
LinuxFirefox

Re: Télécharger vidéos flash youtube et conversion avec ffmpeg

sinon il y a aussi cet outil : E.M. Youtube Video Download Tool
http://www.effectmatrix.com/Youtube_vid … /index.htm
source : http://forums.fedoraforum.org/forum/sho … ube+videos


un pinguin sur la banquise !

Hors ligne

#9 01-05-2008 14:48:18

bob031
Modérateur
LinuxFirefox

Re: Télécharger vidéos flash youtube et conversion avec ffmpeg

extraire la partie audio d'un video youtube

première méthode :


Code:

[redfox@fedora8 Bureau]$ mplayer -dumpaudio myvideo.flv
MPlayer 1.0rc2-4.1.2 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Celeron(R) CPU 2.80GHz (Family: 15, Model: 4, Stepping: 1)
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing myvideo.flv.
libavformat file format detected.
[lavf] Video stream found, -vid 0
[lavf] Audio stream found, -aid 1
VIDEO: [FLV1] 320x240 0bpp 25.000 fps 0.0 kbps ( 0.0 kbyte/s)
Core dumped

Exiting... (End of file)
[redfox@fedora8 Bureau]$

cela ne semble pas fonctionner pourtant, est apparu un nouveau fichier nommé "stream.dump".
je peux l'écouter sans problème (je reconnais bien la bande son de la vidéo) !


deuxième méthode :

Code:

[redfox@fedora8 Bureau]$ ffmpeg -i myvideo.flv -f mp3 -vn -acodec copy myvideo.mp3
FFmpeg version SVN-r10703, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --prefix=/usr --incdir=/usr/include/ffmpeg --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --arch=i386 --extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables --enable-liba52 --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libogg --enable-libtheora --enable-libvorbis --enable-libxvid --enable-libx264 --enable-pp --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-opts --disable-strip
libavutil version: 49.5.0
libavcodec version: 51.45.0
libavformat version: 51.14.0
built on Oct 18 2007 03:11:06, gcc: 4.1.2 20070925 (Red Hat 4.1.2-31)

Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)
Input #0, flv, from 'myvideo.flv':
Duration: 00:05:00.0, start: 0.000000, bitrate: 56 kb/s
Stream #0.0: Video: flv, yuv420p, 320x240, 25.00 fps(r)
Stream #0.1: Audio: mp3, 22050 Hz, mono, 56 kb/s
Output #0, mp3, to 'trumpet.mp3':
Stream #0.0: Audio: libmp3lame, 22050 Hz, mono, 56 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Press [q] to stop encoding
size= 2321kB time=300.0 bitrate= 63.4kbits/s
video:0kB audio:2321kB global headers:0kB muxing overhead 0.001347%
[redfox@fedora8 Bureau]$

j'obtiens bien un fichier "myvideo.mp3" !


maintenant si on regarde bien  :
[redfox@fedora8 Bureau]$ ls -l stream.dump myvideo.mp3
-rw-rw-r-- 1 redfox redfox 2376318 mai 1 14:04 stream.dump
-rw-rw-r-- 1 redfox redfox 2376350 mai 1 14:19 myvideo.mp3
[redfox@fedora8 Bureau]$

je peux lire les 2 fichiers sans problème avec Totem par exemple !


un pinguin sur la banquise !

Hors ligne

#10 06-07-2010 22:39:26

bighunter
Nouveau membre
WindowsXPFirefox

Re: Télécharger vidéos flash youtube et conversion avec ffmpeg

moi je connais une methode tres efficace : http://youtubetoday01.blogspot.com/
tu peux avec cette methode telecharger tes videos de n'importe quel site des videos avec une tres tres bonne qualité

Hors ligne

#11 08-07-2010 10:24:12

coyotus
Contributeur
LinuxFirefox

Re: Télécharger vidéos flash youtube et conversion avec ffmpeg

moi j'utilise downloadhelper et je lis avec vlc

Hors ligne

#12 14-03-2011 15:52:30

Fel
Habitué
WindowsXPSafari

Re: Télécharger vidéos flash youtube et conversion avec ffmpeg

smile Bonjour ou bonne nuit,

Je pouvais proposer ça aussi (en sus) :

http://cyber-nux.fr/forum/26-utilitaire … -take#5194

Hors ligne

Pied de page des forums

Propulsé par FluxBB
Traduction par FluxBB.fr