Raspbian - streaming avec raspivid - temps de latence
Bonjour,
J'utilise raspivid sous raspbian buster sur un raspberry pi 3B+ pour faire du streaming et ça fonctionne mais il y a plusieurs seconds de latence, c'est trop.
raspbian avec une adresse IP : 192.168.0.10 pour créer le flux
raspivid -n -t 0 -w 640 -h 480 -vf -hf -l -o tcp://0.0.0.0:1234
pour lire le flux
vlc avec interface graphique
tcp/h264://192.168.0.10:1234
vlc en ligne de commande
cvlc tcp/h264://192.168.0.10:1234
Les paramètres de raspivid sont les suivants :
"raspistill" Camera App (commit 7cbfbd38d982 Tainted)
Runs camera for specific time, and take JPG capture at end if requested
usage: raspistill [options]
Image parameter commands
-q, --quality : Set jpeg quality <0 to 100>
-r, --raw : Add raw bayer data to jpeg metadata
-l, --latest : Link latest complete image to filename <filename>
-t, --timeout : Time (in ms) before takes picture and shuts down (if not specified, set to 5s)
-th, --thumb : Set thumbnail parameters (x:y:quality) or none
-d, --demo : Run a demo mode (cycle through range of camera options, no capture)
-e, --encoding : Encoding to use for output file (jpg, bmp, gif, png)
-x, --exif : EXIF tag to apply to captures (format as 'key=value') or none
-tl, --timelapse : Timelapse mode. Takes a picture every <t>ms. %d == frame number (Try: -o img_%04d.jpg)
-fp, --fullpreview : Run the preview using the still capture resolution (may reduce preview fps)
-k, --keypress : Wait between captures for a ENTER, X then ENTER to exit
-s, --signal : Wait between captures for a SIGUSR1 or SIGUSR2 from another process
-g, --gl : Draw preview to texture instead of using video render component
-gc, --glcapture : Capture the GL frame-buffer instead of the camera image
-bm, --burst : Enable 'burst capture mode'
-dt, --datetime : Replace output pattern (%d) with DateTime (MonthDayHourMinSec)
-ts, --timestamp : Replace output pattern (%d) with unix timestamp (seconds since 1970)
-fs, --framestart : Starting frame number in output pattern(%d)
-rs, --restart : JPEG Restart interval (default of 0 for none)
GL parameter commands
-gs, --glscene : GL scene square,teapot,mirror,yuv,sobel,vcsm_square
-gw, --glwin : GL window settings <'x,y,w,h'>
Common Settings commands
-?, --help : This help information
-w, --width : Set image width <size>
-h, --height : Set image height <size>
-o, --output : Output filename <filename> (to write to stdout, use '-o -'). If not specified, no file is saved
-v, --verbose : Output verbose information during run
-cs, --camselect : Select camera <number>. Default 0
-md, --mode : Force sensor mode. 0=auto. See docs for other modes available
-gps, --gpsdexif : Apply real-time GPS information to output (e.g. EXIF in JPG, annotation in video (requires libgps.so.22)
Preview parameter commands
-p, --preview : Preview window settings <'x,y,w,h'>
-f, --fullscreen : Fullscreen preview mode
-op, --opacity : Preview window opacity (0-255)
-n, --nopreview : Do not display a preview window
Image parameter commands
-sh, --sharpness : Set image sharpness (-100 to 100)
-co, --contrast : Set image contrast (-100 to 100)
-br, --brightness : Set image brightness (0 to 100)
-sa, --saturation : Set image saturation (-100 to 100)
-ISO, --ISO : Set capture ISO
-vs, --vstab : Turn on video stabilisation
-ev, --ev : Set EV compensation - steps of 1/6 stop
-ex, --exposure : Set exposure mode (see Notes)
-fli, --flicker : Set flicker avoid mode (see Notes)
-awb, --awb : Set AWB mode (see Notes)
-ifx, --imxfx : Set image effect (see Notes)
-cfx, --colfx : Set colour effect (U:V)
-mm, --metering : Set metering mode (see Notes)
-rot, --rotation : Set image rotation (0-359)
-hf, --hflip : Set horizontal flip
-vf, --vflip : Set vertical flip
-roi, --roi : Set region of interest (x,y,w,d as normalised coordinates [0.0-1.0])
-ss, --shutter : Set shutter speed in microseconds
-awbg, --awbgains : Set AWB gains - AWB mode must be off
-drc, --drc : Set DRC Level (see Notes)
-st, --stats : Force recomputation of statistics on stills capture pass
-a, --annotate : Enable/Set annotate flags or text
-3d, --stereo : Select stereoscopic mode
-dec, --decimate : Half width/height of stereo image
-3dswap, --3dswap : Swap camera order for stereoscopic
-ae, --annotateex : Set extra annotation parameters (text size, text colour(hex YUV), bg colour(hex YUV), justify, x, y)
-ag, --analoggain : Set the analog gain (floating point)
-dg, --digitalgain : Set the digital gain (floating point)
-set, --settings : Retrieve camera settings and write to stdout
Notes
Exposure mode options :
off,auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks
Flicker avoid mode options :
off,auto,50hz,60hz
AWB mode options :
off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon
Image Effect mode options :
none,negative,solarise,sketch,denoise,emboss,oilpaint,hatch,gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,posterise,colourpoint,colourbalance,cartoon
Metering Mode options :
average,spot,backlit,matrix
Dynamic Range Compression (DRC) options :
off,low,med,high
Voilà, quelqu'un aurait une idée pour diminuer le temps de latence ?
J'utilise raspivid sous raspbian buster sur un raspberry pi 3B+ pour faire du streaming et ça fonctionne mais il y a plusieurs seconds de latence, c'est trop.
raspbian avec une adresse IP : 192.168.0.10 pour créer le flux
raspivid -n -t 0 -w 640 -h 480 -vf -hf -l -o tcp://0.0.0.0:1234
pour lire le flux
vlc avec interface graphique
tcp/h264://192.168.0.10:1234
vlc en ligne de commande
cvlc tcp/h264://192.168.0.10:1234
Les paramètres de raspivid sont les suivants :
"raspistill" Camera App (commit 7cbfbd38d982 Tainted)
Runs camera for specific time, and take JPG capture at end if requested
usage: raspistill [options]
Image parameter commands
-q, --quality : Set jpeg quality <0 to 100>
-r, --raw : Add raw bayer data to jpeg metadata
-l, --latest : Link latest complete image to filename <filename>
-t, --timeout : Time (in ms) before takes picture and shuts down (if not specified, set to 5s)
-th, --thumb : Set thumbnail parameters (x:y:quality) or none
-d, --demo : Run a demo mode (cycle through range of camera options, no capture)
-e, --encoding : Encoding to use for output file (jpg, bmp, gif, png)
-x, --exif : EXIF tag to apply to captures (format as 'key=value') or none
-tl, --timelapse : Timelapse mode. Takes a picture every <t>ms. %d == frame number (Try: -o img_%04d.jpg)
-fp, --fullpreview : Run the preview using the still capture resolution (may reduce preview fps)
-k, --keypress : Wait between captures for a ENTER, X then ENTER to exit
-s, --signal : Wait between captures for a SIGUSR1 or SIGUSR2 from another process
-g, --gl : Draw preview to texture instead of using video render component
-gc, --glcapture : Capture the GL frame-buffer instead of the camera image
-bm, --burst : Enable 'burst capture mode'
-dt, --datetime : Replace output pattern (%d) with DateTime (MonthDayHourMinSec)
-ts, --timestamp : Replace output pattern (%d) with unix timestamp (seconds since 1970)
-fs, --framestart : Starting frame number in output pattern(%d)
-rs, --restart : JPEG Restart interval (default of 0 for none)
GL parameter commands
-gs, --glscene : GL scene square,teapot,mirror,yuv,sobel,vcsm_square
-gw, --glwin : GL window settings <'x,y,w,h'>
Common Settings commands
-?, --help : This help information
-w, --width : Set image width <size>
-h, --height : Set image height <size>
-o, --output : Output filename <filename> (to write to stdout, use '-o -'). If not specified, no file is saved
-v, --verbose : Output verbose information during run
-cs, --camselect : Select camera <number>. Default 0
-md, --mode : Force sensor mode. 0=auto. See docs for other modes available
-gps, --gpsdexif : Apply real-time GPS information to output (e.g. EXIF in JPG, annotation in video (requires libgps.so.22)
Preview parameter commands
-p, --preview : Preview window settings <'x,y,w,h'>
-f, --fullscreen : Fullscreen preview mode
-op, --opacity : Preview window opacity (0-255)
-n, --nopreview : Do not display a preview window
Image parameter commands
-sh, --sharpness : Set image sharpness (-100 to 100)
-co, --contrast : Set image contrast (-100 to 100)
-br, --brightness : Set image brightness (0 to 100)
-sa, --saturation : Set image saturation (-100 to 100)
-ISO, --ISO : Set capture ISO
-vs, --vstab : Turn on video stabilisation
-ev, --ev : Set EV compensation - steps of 1/6 stop
-ex, --exposure : Set exposure mode (see Notes)
-fli, --flicker : Set flicker avoid mode (see Notes)
-awb, --awb : Set AWB mode (see Notes)
-ifx, --imxfx : Set image effect (see Notes)
-cfx, --colfx : Set colour effect (U:V)
-mm, --metering : Set metering mode (see Notes)
-rot, --rotation : Set image rotation (0-359)
-hf, --hflip : Set horizontal flip
-vf, --vflip : Set vertical flip
-roi, --roi : Set region of interest (x,y,w,d as normalised coordinates [0.0-1.0])
-ss, --shutter : Set shutter speed in microseconds
-awbg, --awbgains : Set AWB gains - AWB mode must be off
-drc, --drc : Set DRC Level (see Notes)
-st, --stats : Force recomputation of statistics on stills capture pass
-a, --annotate : Enable/Set annotate flags or text
-3d, --stereo : Select stereoscopic mode
-dec, --decimate : Half width/height of stereo image
-3dswap, --3dswap : Swap camera order for stereoscopic
-ae, --annotateex : Set extra annotation parameters (text size, text colour(hex YUV), bg colour(hex YUV), justify, x, y)
-ag, --analoggain : Set the analog gain (floating point)
-dg, --digitalgain : Set the digital gain (floating point)
-set, --settings : Retrieve camera settings and write to stdout
Notes
Exposure mode options :
off,auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks
Flicker avoid mode options :
off,auto,50hz,60hz
AWB mode options :
off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon
Image Effect mode options :
none,negative,solarise,sketch,denoise,emboss,oilpaint,hatch,gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,posterise,colourpoint,colourbalance,cartoon
Metering Mode options :
average,spot,backlit,matrix
Dynamic Range Compression (DRC) options :
off,low,med,high
Voilà, quelqu'un aurait une idée pour diminuer le temps de latence ?
A voir également:
- Raspivid parameters
- Binding entities to query parameters only allowed for entities that have an identifier. - Forum PHP
- Exception processing message 0x00013 unexpected parameters ✓ - Forum Windows
- Exception Processing c0000013 75afbf7c 4 75af - Forum Réseaux sociaux
- Binding entities to query parameters only allowed for entities that have an identifier ✓ - Forum C#
- Erreur!SQLSTATE[HY093]: Invalid parameter number: no parameters were bound ✓ - Forum PHP
7 réponses
Bonjour,
Est-ce que cette latence n'est pas juste due au temps nécessaire pour encoder la vidéo (ce qui est crédible si le CPU n'est pas très élevé) ou au transfert de la vidéo ?
Car dans la liste de paramètre, rien ne semble en rapport avec la latence et il serait bizarre qu'un outil introduise par défaut une latence qu'on ne peut pas "désactiver".
Bonne chance
Est-ce que cette latence n'est pas juste due au temps nécessaire pour encoder la vidéo (ce qui est crédible si le CPU n'est pas très élevé) ou au transfert de la vidéo ?
Car dans la liste de paramètre, rien ne semble en rapport avec la latence et il serait bizarre qu'un outil introduise par défaut une latence qu'on ne peut pas "désactiver".
Bonne chance
Finalement, en prenant l'encodage MJPEG plutôt que h264 j'ai moins de latence, et elle est constante.
raspivid -n -t 0 -w 640 -h 480 -vf -hf -cd MJPEG -l -o tcp://0.0.0.0:1234
presque résolu
raspivid -n -t 0 -w 640 -h 480 -vf -hf -cd MJPEG -l -o tcp://0.0.0.0:1234
presque résolu
Bonjour,
Cela laisse penser que l'encodeur h264 est "coûteux" en temps de calcul ce qui induit le délai dont tu parles. Je présume que l'encodage que tu utilises est moins coûteux et donc la latence est moins perceptible...
Cela laisse penser que l'encodeur h264 est "coûteux" en temps de calcul ce qui induit le délai dont tu parles. Je présume que l'encodage que tu utilises est moins coûteux et donc la latence est moins perceptible...
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
C'est ça, ou pour être plus précis, il semble que cet encodage soit trop coûteux pour le système et le matériel considéré (peut-être que sur une machine plus puissante sous raspbian, ce choix pourrait être envisagé).