Capturer un flux RTSP dans un fichier via ffmpeg
J’ai eu besoin de récupérer un flux RTSP, protocole souvent utilisé pour streamer des vidéos sur Internet.
Pour cela, un seul outil dans ma boite à outils m’aura été utile : ffmpeg.
La ligne de commande est simple :
ffmpeg -i rtsp://123.45.67.89/file.mp4 -acodec copy -vcodec copy local.mp4
Soit au final :
C:\Users\user>ffmpeg -i rtsp://123.45.67.89/file.mp4 -acodec copy -vcodec copy local.mp4 ffmpeg version N-50911-g9efcfbe Copyright (c) 2000-2013 the FFmpeg developers built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 19.100 / 52. 19.100 libavcodec 55. 0.100 / 55. 0.100 libavformat 55. 0.100 / 55. 0.100 libavdevice 54. 4.100 / 54. 4.100 libavfilter 3. 45.103 / 3. 45.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 [rtsp @ 022daae0] UDP timeout, retrying with TCP Input #0, rtsp, from 'rtsp://123.45.67.89/file.mp4': Metadata: title : WowzaMediaServer Duration: 00:51:49.30, start: 0.000000, bitrate: N/A Stream #0:0: Audio: aac, 48000 Hz, stereo, fltp Stream #0:1: Video: h264 (Main), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Output #0, mp4, to 'local.mp4': Metadata: title : WowzaMediaServer encoder : Lavf55.0.100 Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 90k tbn, 90k tbc Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo Stream mapping: Stream #0:1 -> #0:0 (copy) Stream #0:0 -> #0:1 (copy) Press [q] to stop, [?] for help [mp4 @ 022d8dc0] pts has no value [mp4 @ 022d8dc0] st:0 PTS: 0 DTS: 0 < 3073 invalid, clipping [mp4 @ 022d8dc0] st:0 PTS: 3600 DTS: 3600 < 7201 invalid, clipping [mp4 @ 022d8dc0] st:0 PTS: 1024 DTS: 1024 < 3074 invalid, clipping [mp4 @ 022d8dc0] st:0 PTS: 2048 DTS: 2048 < 3075 invalid, clipping [mp4 @ 022d8dc0] st:0 PTS: 3072 DTS: 3072 < 3076 invalid, clipping [mp4 @ 022d8dc0] st:0 PTS: 10800 DTS: 7200 < 7202 invalid, clipping frame=77732 fps= 24 q=-1.0 Lsize= 417624kB time=00:51:49.23 bitrate=1100.3kbits/s 58.88 bitrate=1087.5kbits/s video:375616kB audio:39718kB subtitle:0 global headers:0kB muxing overhead 0.551422%
Ajouter un commentaire