Streaming video avec netcat et mencoder

netcat & mencoder

Serveur Side

open_streaming.sh

#!/bin/bash

# 500 is acceptable for bitrate, 1000 gives very nice quality

BITRATE=500

MAX_XRES=640

MAX_YRES=480

LISTEN_PORT=443

# oac copy should work fine most of the time

#AUDIO="-oac mp3lame -lameopts preset=192"

AUDIO="-oac copy"

mkfifo "/tmp/maemo_stream-$$"

{ nc -q 0 -l -p $LISTEN_PORT < "/tmp/maemo_stream-$$"; killall -9 mencoder; rm -f "/tmp/maemo_stream-$$"; } &

mencoder -o "/tmp/maemo_stream-$$" $AUDIO -ovc lavc \

-lavcopts vcodec=mpeg4:vbitrate=${BITRATE}:aspect=${MAX_XRES}/${MAX_YRES}:mbd=2:trell:threads=2 \

-idx -zoom -vf-add dsize=${MAX_XRES}:${MAX_YRES}:2,scale \

-vf-add expand=${MAX_XRES}:${MAX_YRES}::::${MAX_XRES}/${MAX_YRES} -vf-add crop=${MAX_XRES}:${MAX_YRES} \

-ffourcc FMP4 "$1"

rm -f "/tmp/maemo_stream-$$"

Client Side

nc -q 0 hostname 443 | mplayer -fs -vo sdl -hardframedrop -cache 512 -cache-min 80 -

Autres articles susceptibles de vous intéresser :

App

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

*

Vous pouvez utiliser ces balises et attributs HTML : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent Tweets

Catégories