Le 12 mars 2016
VMix to RpiDATV via FFmpeg
by Alain Fort Ham radio F1CJN
french and english
texts
Ce tutoriel explique comment envoyer de la vidéo vers le programme Raspberry RpiDATV d' Evariste F5OEO, à partir de vidéos réalisées en temps réel grâce au programme Vmix.
L'envoi du flux vidéo se fait au travers du réseau Ethernet local.
Le fichier Vmix2Rpi a été construit à partir du fichier bat, de Chris MWOLLK, qui permet de générer un Transport Stream.
Pré requis: un Pc avec au minimum Windows7 et une vidéo compatible directX11.
1) Installer Vmix, programme très pratique de mixeur en temps réel de diverses sources vidéo (caméra usb, numériseur vidéo, vidéo enregistrées tout formats, images, texte en sur impression ....) :
- soit la version gratuite qui permet d'utiliser 4 sources distinctes dont une en sur impression. C'est celle que je conseille car sans limitation en durée.
- soit la version gratuite 60 jours sans limite en nombre de sources, de format d'image, de sur impressions mais avec une limitée en durée à 60 jours qui redevient la version ci-dessus après la date limite.
2) Installer FFmpeg version Windows sur le disque C en emplacement racine C:\
Choisir la version 32 ou 64 bits correspondant à votre PC.
Si vous l'installez à un autre emplacement, il sera nécessaire de modifier la dernière (longue) ligne de commande en précisant votre emplacement.
3) Charger le fichier Vmix2Rpi.bat et placer le sur le bureau (voir en fin de document)
Utilisation
1) Lancer Vmix et choisir votre source en entrée pour avoir une sortie sur l'écran de droite, ensuite appuyer sur externe (en bas de l'écran) qui doit passer au rouge.
2) Puis un double click sur l'icone Vmix2Rpi pour lancer le fichier.bat
3) Lancer le programme RpiDATV en mode I/Q (je n'ai pas testé les autres modes) SR 1500 par exemple, mode d'entrée IQTSIN et mettre l'adresse 230.0.0.2
A réaliser ensuite par l'utilisateur dans le Fichier Vmix2Rpi
1) Remplacer dans la longue ligne de commande "Vmix2Rpi" par votre indicatif
2) Mettre vos PID, Program Steam ID personnels
This
tutorial is made to show how to send video to the Raspberry RpiDATV program writtent by Evariste F5OEO, from
real time video de vidéos realized with the Vmix program.
The video
stream is send through the local Ethernet network.
The
Vmix2Rpi.bat file was made starting from the .bat from Chris MWOLLK Transport
Stream generation.
Pre required: a Pc with Windows7 minimum and a graphics
compatible to directX11.
1)
Install Vmix, it is a very useful and easy tool to
use as a real time video mixer for up to four sources (free version) as webcam, usb
video grabber, vidéo file from many formats, images,
text for overlay ....)
- either the free version. It permits to use 4 different video
sources with one as overlay.
I suggest to use this one for ham radio use.
- or the free version limited to
60 days but with not limits for the number of video sources, image resolution, overlay channels. After the 60 days then the
program is limited.
2) Install FFmpeg Windows version on the C
drive at the root C:\.
If it is
installed in another place, the last command line must be modified, according
to the place of FFmpeg install.
3) Download
or copy the text Vmix2Rpi.bat
and place it on the desktop
Use
1) Start Vmix and select the input video source and select and
output on the right video window, then click on "external" ( down on the screen) . "External" goes to color red.
2) Then a
double click on Vmix2Rpi.bat icon to start the .bat file.
3) Start
the RpiDATV program with the I/Q mode (other modes have
not been tested) with for example a SR1500, input mode IQTSIN with the
230.0.0.2 address.
Then later, to be done by the user in the
Vmix2Rpi.bat file.
1) Replace
in the long command line
"Vmix2Rpi" with
your call.
2) Modify
the file with your own PID, Program Steam ID.
Vmix2Rpi.bat
@echo off
rem vMix to Transport
Stream for RpiDATV
rem by Alain Fort F1CJN march 2016 modified from Chris
mw0llk January 2015.
rem with thanks to Rob m0dts for the linux shell script on which this was based.
echo
Enter the following values to start the Tx, Press
Enter for default (previous) values
if
X%SR%==X set SR=1000
set defSR=%SR%
set /p
SR=Enter SR in KS (%SR%):
if
X%SR%==X set SR=%defSR%
if
X%FEC%==X set FEC=5/6
set defFEC=%FEC%
set /p
FEC=Enter FEC in KS (%FEC%):
if
X%FEC%==X set FEC=%defFEC%
rem Save values for next time
rem If these lines cause errors your system may
not support SETX
rem If so just comment them out
if not
%SR%==%defSR% setx SR
"%SR%"
if not
%FEC%==%defFEC% setx FEC
"%FEC%"
echo
Symbol rate: %SR%, FEC: %FEC%. Calculating bitrates...
rem Calculate Video bit rate value for current
SR/FEC
set /a
DSR=2*%SR%
echo DSR
is %DSR%
set /a
DECFEC=1000*%FEC%
set /a
RS=188000/204
set /a
TS=%DSR% * %RS% / 1000 * %DECFEC% / 1000
set /a
TSMAUD=%TS%-128
set /a
VIDRATE=%TSMAUD% * 75 / 100
set /a
BUFSIZE=%VIDRATE% * 7 /10
echo
Transport Stream rate for current SR/FEC is: %TS%
echo
Video bit-rate: %VIDRATE%
rem Show the parameters during 2 seconds (rem the 4 next lines it if you don't need it)
@echo off
echo
%time%
timeout 2
> NUL
echo
%time%
start
"Video feed to RpiDATV" /high c:\ffmpeg\bin\ffmpeg -f dshow -i video="vMix Video" -f dshow -i audio="vMix Audio" -vf
"drawtext=fontfile='C\:\\Windows\\Fonts\\verdanab.ttf':text=Vmix2Rpi':x=60:y=34:fontsize=30:fontcolor=0xffffff7f:shadowcolor=0x003f007f:shadowx=2:shadowy=2"
-f mpeg2video -pix_fmt yuv420p -r 25 -s 720x576
-aspect 4:3 -qmin 2 -qmax
35 -b:v %VIDRATE%k -minrate %VIDRATE%k -maxrate %VIDRATE%k -bufsize %BUFSIZE%k -acodec mp2 -ab 128k -ac 2 -f mpegts -mpegts_original_network_id
1 -mpegts_transport_stream_id 1 -mpegts_service_id
1 -mpegts_pmt_start_pid 4096 -streamid
0:33 -streamid 1:49 -metadata service_provider="Vmix2Rpi"
-metadata service_name="My Station ID" -y
udp://230.0.0.2:10000?pkt_size=1316