Ceci est une ancienne révision du document !
rtmpdump est un outil qui permet de récupérer le contenu d'un flux rtmp. Rien d'illégal est soit, on donne un flux en streaming, on a juste envie de l'écouter de la façon dont on veut. Seulement l'utilisation n'est pas toujours facile. Aide mémo:
1 | --rtmp -r url |
2 | URL of the server and media content. |
3 | |
4 | --app -a app |
5 | Name of application to connect to on the RTMP server. Overrides the app in the RTMP URL. Sometimes the rtmpdump URL parser cannot determine the app name automatically, so it must be given explicitly using this option. |
6 | |
7 | --tcUrl -t url |
8 | URL of the target stream. Defaults to rtmp[e]://host[:port]/app/playpath. |
9 | |
10 | --pageUrl -p url |
11 | URL of the web page in which the media was embedded. By default no value will be sent. |
12 | |
13 | --swfUrl -s url |
14 | URL of the SWF player for the media. By default no value will be sent. |
15 | |
16 | --flv -o output |
17 | Specify the output file name. If the name is − or is omitted, the stream is written to stdout. |
Prenons comme exemple la musique du film The Hobbit qui peut être écoutée ici. Seulement c'est en une seule piste (1h45) dans un sale player flash où on sait même pas avancer.
En décompilant (flasm est ton ami) le fichier swf, on découvre ceci (output complet)
1 | 'rtmp://fl.interoute.com/streamrt', |
2 | 'mp3:{6ffab433-1c7d-4a4a-a9cc-472ebc88c47e}/{c9b64919-4aa0-4237-a882-e9fd15b8712f}/TheHobbit.mp3', |
ou en écoutant avec Wireshark, on voit ceci passer
1 | connect.?..........app...streamrt..flashVer...LNX 11,2,202,251..swfUrl...http://www.decca.com/hosting/hobbit/Hobbit.swf..tcUr.l.. rtmp://fl.interoute.com/streamrt..fpad....capabilities.@m........audioCodecs.@.........videoCodecs.@o....... |
2 | videoFunction.?..........pageUrl..$http://www.decca.com/hosting/hobbit/.... |
3 | [...] |
4 | .C..........createStream.@......................._result.@.........?.............s........play............_mp3:{6ffab433-1c7d-4a4a-a9cc-472ebc88c47e}/{c9b64919-4aa0-4237-a882-e9fd15b8712f}/TheHobbit.mp3 |
Ce qui est beau avec Wireshark, c'est qu'on a nos paramètres quasi déjà tout fait. On identifie donc facilement les paramètres et arrive à la commande suivante :
1 | $ rtmpdump --app streamrt --swfUrl http://www.decca.com/hosting/hobbit/Hobbit.swf --tcpUrl rtmp://fl.interoute.com/streamrt --pageUrl http://www.decca.com/hosting/hobbit/ --playpath "mp3:{6ffab433-1c7d-4a4a-a9cc-472ebc88c47e}/{c9b64919-4aa0-4237-a882-e9fd15b8712f}/TheHobbit.mp3" -o TheHobbit.mp3 |
qui produit un beau mp3. Bon bien sûr n'allez pas partager se fichier .mp3 sur des réseaux P2P, là vous deviendrez illégal. À bon entendeur…