Comment diffuser un fichier vidéo statique

Bonjour, j'essaie de diffuser un fichier vidéo (situé dans le disque dur de la machine locale) au réseau domestique / LAN.

J'essaie de le faire depuis une semaine maintenant. J'ai essayé toutes les ressources que je pourrais trouver, puis, en dernier recours, posez cette question ici.

1. Le fichier vidéo est présent dans le disque dur de la machine locale.
2. besoin de diffuser via le protocole HTTP.
3. Tout serveur GPL fonctionnerait, mais préférez ffmpeg ou vlc.

Merci. J'apprécie toute aide à ce sujet.

Voici quelques éléments que j'ai déjà essayés.

VLC:

Cela fonctionne de façon intermittente. Mais aucun audio ne vient, seule la vidéo est reçue.

Sur la fin du serveur:

ffmpeg -i sample.mp4 -vcodec libx264 -acodec aac -ar 48000 -strict experimental -f flv "rtmp://127.0.0.1:1935/live/myStream" vlc rtp://@10.1.10.102:9001 

Ffmpeg:

étape 1:

Exécuter le serveur ffmpeg

  ffserver -d -f /etc/ffserver.conf ffserver version N-80026-g936751b Copyright (c) 2000-2016 the FFmpeg developers 

Étape 2: flux

 ffmpeg -i SampleVideo_1280x720_2mb.mp4 -vcodec libx264 -acodec aac -ar 48000 -strict experimental -f flv "rtmp://localhost/live/myStream" ffmpeg version N-80026-g936751b Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3) configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab libavutil 55. 24.100 / 55. 24.100 libavcodec 57. 42.100 / 57. 42.100 libavformat 57. 36.100 / 57. 36.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 45.100 / 6. 45.100 libavresample 3. 0. 0 / 3. 0. 0 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'SampleVideo_1280x720_2mb.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf53.24.2 Duration: 00:00:13.50, start: 0.000000, bitrate: 1248 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 862 kb/s, 25 fps, 25 tbr, 12800 tbn (default) Metadata: creation_time : 1970-01-01 00:00:00 handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 381 kb/s (default) Metadata: creation_time : 1970-01-01 00:00:00 handler_name : SoundHandler [tcp @ 0x3a4c920] Connection to tcp://localhost:1935 failed: Connection refused [rtmp @ 0x3a4c8a0] Cannot open connection tcp://localhost:1935 rtmp://localhost/live/myStream: Connection refused 

Plus de commandes:

 ffmpeg -i "SampleVideo_1280x720_2mb.mp4" -re -f mpegts "udp://127.0.0.1:2000" ffmpeg version N-80026-g936751b Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3) configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab libavutil 55. 24.100 / 55. 24.100 libavcodec 57. 42.100 / 57. 42.100 libavformat 57. 36.100 / 57. 36.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 45.100 / 6. 45.100 libavresample 3. 0. 0 / 3. 0. 0 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'SampleVideo_1280x720_2mb.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf53.24.2 Duration: 00:00:13.50, start: 0.000000, bitrate: 1248 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 862 kb/s, 25 fps, 25 tbr, 12800 tbn (default) Metadata: creation_time : 1970-01-01 00:00:00 handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 381 kb/s (default) Metadata: creation_time : 1970-01-01 00:00:00 handler_name : SoundHandler Option re (read input at native frame rate) cannot be applied to output file udp://127.0.0.1:2000 -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. Error parsing options for output file udp://127.0.0.1:2000. Error opening output files: Invalid argument 

Mon fichier de configuration ffmpeg:

 cat /etc/ffserver.conf Port 8090 # Port to bind the server to BindAddress 0.0.0.0 MaxHTTPConnections 2000 MaxClients 1000 MaxBandwidth 10000 # Maximum bandwidth per client # set this high enough to exceed stream bitrate CustomLog - NoDaemon # Remove this if you want FFserver to daemonize after start <Feed feed1.ffm> # This is the input feed where FFmpeg will send File ./feed1.ffm # video stream. FileMaxSize 1G # Maximum file size for buffering video ACL allow 127.0.0.1 # Allowed IPs </Feed> <Stream test.webm> # Output stream URL definition Feed feed1.ffm # Feed from which to receive video Format webm # Audio settings AudioCodec vorbis AudioBitRate 64 # Audio bitrate # Video settings VideoCodec libvpx VideoSize 720x576 # Video resolution VideoFrameRate 25 # Video FPS AVOptionVideo flags +global_header # Parameters passed to encoder # (same as ffmpeg command-line parameters) AVOptionVideo cpu-used 0 AVOptionVideo qmin 10 AVOptionVideo qmax 42 AVOptionVideo quality good AVOptionAudio flags +global_header PreRoll 15 StartSendOnKey VideoBitRate 400 # Video bitrate </Stream> <Stream status.html> # Server status URL Format status # Only allow local people to get the status ACL allow localhost ACL allow 192.168.0.0 192.168.255.255 </Stream> <Redirect index.html> # Just an URL redirect for index # Redirect index.html to the appropriate site URL http://www.ffmpeg.org/ </Redirect> 

Remarque :

La commande suivante ne donne aucune erreur. Mais le client ne montre aucune vidéo ou audio,

 ffmpeg -re -i "SampleVideo_1280x720_2mb.mp4" -f mpegts "udp://10.1.10.102:2000" 

Celui-ci dit tuyau brisé:

 ffmpeg -re -i SampleVideo_1280x720_2mb.mp4 -acodec copy -vcodec copy -f flv rtmp://10.1.10.102:8090/SampleVideo_1280x720_2mb.mp4 

Je ne sais pas si ma réponse vous aidera, mais si vous avez besoin de jouer à des fichiers vidéo par LAN, vous pouvez simplement les partager à l'aide d'un serveur HTTP (ou même FTP).

Sur l'ordinateur qui héberge les fichiers vidéo (serveur), installez un serveur Web de votre choix, p.ex.

 sudo apt-get install apache2 # or sudo apt-get install lighttpd 

Mettez vos fichiers vidéo dans le répertoire Web (habituellement /var/www ) ou les lisez sympa.

Sur l'ordinateur qui doit jouer la vidéo (client), exécuter

 wget http://server/something.avi -O - | mplayer -cache 8192 - 

Ou vous pouvez lancer vlc et lui dire d'ouvrir le fichier http://server/something.avi .

Sauf si vous avez un DNS dans votre réseau local, vous devrez probablement remplacer le server par son adresse, qui ressemble habituellement à 192.168.XY