Recherche avancée

Médias (91)

Autres articles (53)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

Sur d’autres sites (7222)

  • Lost video stream when streaming using FFmpeg and RTSP camera

    13 février 2019, par Vape

    on the Linux server, I have FFmpeg installed which streams video from Chinese low-cost IP camera to Twitch or Youtube server. After a few hours, the video is not visible but on the server side, the FFmpeg is still running and also the IP camera respond to the "ping" command.

    Here is the script I’m using :

    #
    # Camera IP
    #
    AQUARIUM_CAM_IP="192.168.123.102"


    #
    # Aquarium data file
    #
    AQUARIUM_DATA_FILE="/run/aquarium-cam/data.txt"


    #
    # FFmpeg parameters
    #
    FFMPEG_LOG_LEVEL=fatal

    # Bitrate (1000k = 1Mbit/s)  and  encoding speed (affects CPU)  and  number of CPU cores to use
    FFMPEG_VBR="1000k"
    FFMPEG_QUAL="ultrafast"
    FFMPEG_THREADS="1"

    # Streaming source
    FFMPEG_CAM_RTSP_SRC="rtsp://${AQUARIUM_CAM_IP}:554/user=admin&password=&channel=1&stream=0.sdp" # Camera source

    # Streaming destination
    FFMPEG_TWITCH_STREAM_URL_DST="rtmp://live-ber.twitch.tv/app"  # RTMP stream URL
    FFMPEG_TWITCH_KEY=""

    # Data overlay setup
    FFMPEG_TEXT_OVERLAY_FONT_PATH="OpenSans-Regular.ttf"
    FFMPEG_TEXT_OVERLAY_FONT_SIZE=25
    FFMPEG_TEXT_OVERLAY_OFFSET_X=5
    FFMPEG_TEXT_OVERLAY_OFFSET_Y=60
    FFMPEG_TEXT_OVERLAY_RELOAD=1
    FFMPEG_TEXT_OVERLAY_BOX="1"
    FFMPEG_TEXT_OVERLAY_BOX_BORDER_WIDTH="5"
    FFMPEG_TEXT_OVERLAY_BOX_COLOR="blue@0.5"

    the FFmpeg script :

    ffmpeg \
       -loglevel ${FFMPEG_LOG_LEVEL} -f lavfi -i anullsrc \
       -rtsp_transport tcp \
       -i "${FFMPEG_CAM_RTSP_SRC}" \
       -vcodec libx264 -pix_fmt yuv420p -preset ${FFMPEG_QUAL} -g 75 -b:v ${FFMPEG_VBR} \
       -vf "\
    drawtext=fontfile=${FFMPEG_TEXT_OVERLAY_FONT_PATH}:textfile=${AQUARIUM_DATA_FILE}:\
    x=${FFMPEG_TEXT_OVERLAY_OFFSET_X}:y=${FFMPEG_TEXT_OVERLAY_OFFSET_X}:\
    reload=${FFMPEG_TEXT_OVERLAY_RELOAD}: \
    fontcolor=white:fontsize=${FFMPEG_TEXT_OVERLAY_FONT_SIZE}:\
    box=${FFMPEG_TEXT_OVERLAY_BOX}:boxborderw=${FFMPEG_TEXT_OVERLAY_BOX_BORDER_WIDTH}:\
    boxcolor=${FFMPEG_TEXT_OVERLAY_BOX_COLOR}"\
       -threads ${FFMPEG_THREADS} -bufsize 512k \
       -f flv "${FFMPEG_TWITCH_STREAM_URL_DST}/${FFMPEG_TWITCH_KEY}"

    The other strange thing is that when the FFmpeg start and the stream begin the CPU utilization is about 30% in the case when there is no stream but the FFmpeg is still alive the CPU utilization is below 20% or less.

    Any Idea how to resolve this kind of problem ?
    Has FFmpeg some option to terminate if there is no "stream" or if it has lost a connection with a camera ?

  • How to optimize FFMPEG/ Chromacast video ?

    5 août 2021, par Hasan

    Re-broadcast a live broadcast by chromecasting it. The code below delays 5 seconds.

    


    Server I use :
https://instances.vantage.sh/?selected=c5.2xlarge

    


    Can you help me optimize the code ?

    


    chromakey.sh

    


    
# Combine two files using a chromakey effects
filter_complex(){
  local videoWith="${1:-1920}"  # Video Size
  local videoHeight="${2:-1080}"  # Video Size
  local key="${3:-00FF00}"      # Colorkey colour - default vaue is 0000FF or green
  local colorSim="${4:-0.2}"    # Colorkey similarity level - default value is 0.2
  local colorBlend="${5:-0.1}"  # Colorkey blending level - default value is 0.1

  # Update color variable according to user input
  # This makes the matching case insensitive
  if [[ $3 =~ ^[0-9A-F]{6}$ ]]; then
    key=$3
  elif [[ $(tr "[:upper:]" "[:lower:]" <<<"$1")  = "blue" ]]; then
    key="0000FF"
  elif [[ $(tr "[:upper:]" "[:lower:]" <<<"$1")  = "green" ]]; then
    key="00FF00"
  elif [[ $(tr "[:upper:]" "[:lower:]" <<<"$1")  = "red" ]]; then
    key="FF0000"
  elif [[ $(tr "[:upper:]" "[:lower:]" <<<"$1")  = "purple" ]]; then
    key="0000FF"
  elif [[ $(tr "[:upper:]" "[:lower:]" <<<"$1")  = "orange" ]]; then
    key="ff9900"
  elif [[ $(tr "[:upper:]" "[:lower:]" <<<"$1")  = "yellow" ]]; then
    key="FFFF00"
  fi

  
  filterString="[1:v]scale=$videoWith x $videoHeight,chromakey=0 x $key:$colorSim:$colorBlend[ckout];[0:v]scale=(iw*sar)*max($videoWith/(iw*sar)\,$videoHeight/ih):ih*max($videoWith/(iw*sar)\,$videoHeight/ih), crop=$videoWith:$videoHeight[bg];[bg][ckout]overlay[out]"
  
  printf '%s%s%s%s%s' $filterString
}

ffmpeg -re -stream_loop -1 -i "${1}" -i "${2}" -preset ultrafast -filter_complex "$(filter_complex "${@:4}")" -map '[out]' -c:v libx264 -f flv "${3}"


    


    Usage : ./chromakey.sh mask.mp4 http://example.com/live/broadcast_orj rtmp ://example.com/live/broadcast_greenscreen 1920 1080 green 0.1 0.2

    


  • ffmpeg transparent png frames to webm gets autocropped and opaque instead of showing the input frames

    26 mai 2022, par Regda

    i got a webm file that outputs transparency as black if transparency is not supported, but unpacking the webm file to png frames outputs the pngs with transparency.
I tried to repack the transparent png frames into a webm file that behaves like described above (transparent but black if not supported).

    


    The current issue (where i need help) is that it looks like ffmpeg applies some sort of optimization, which creates an area filled with an analyzed color, cropping it to the size of the opaque content/pixels and leaving the rest white.
    
And i don't want this.

    


    Related to VLC the metadata of the original says that Lavc58.65.102 libvpx-vp9 was used as encoder and that the Stream0 has the following informations :

    


    Codec: Google/On2's VP9 Video (VP90)
Language: English
Type: Video
Video resolution: 816x624
Buffer dimensions: 816x640
Frame rate: 30.000300
Decoded format: Planar 4:2:0 YUV
Orientation: Top left


    


    To reproduce the issue i created 2 transparent frames (a green and a blue cross) where the opaque content is smaller then the image size and copied them 10-times to be able to actually preview the webm file in vlc, the 2 frames do look like below :
shows the 2 different frames used for reproducing the transparency issue

    


    Then i clicked together the following ffmpeg command and executed it :
    
ffmpeg -framerate 30 -t 7.2 -i frames/%04d.png -b:v 1307k -c:v libvpx-vp9 -color_range 1 -pix_fmt yuva420p -metadata:s:v:0 alpha_mode="1" out.webm
(changing the pixel format e.g. from yuv to yuva doesn't seem to change anything)

    


    ffmpeg console output :

    


    ffmpeg version N-102605-g4c705a2775 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10-win32 (GCC) 20210408
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-version3 --disable-debug --enable-shared --disable-static --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --enable-amf --enable-libaom --disable-avisynth --enable-libdav1d --disable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --disable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libvidstab --disable-libx264 --disable-libx265 --disable-libxavs2 --disable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  1.100 / 59.  1.100
  libavformat    59.  2.101 / 59.  2.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.101 /  8.  0.101
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
Input #0, image2, from 'frames/%04d.png':
  Duration: 00:00:00.67, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: png, rgba(pc), 816x624 [SAR 2835:2835 DAR 17:13], 30 fps, 30 tbr, 30 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 000001c97b52b000] v1.10.0
Output #0, webm, to 'out.webm':
  Metadata:
    encoder         : Lavf59.2.101
  Stream #0:0: Video: vp9, yuv420p(tv, progressive), 816x624 [SAR 1:1 DAR 17:13], q=2-31, 1307 kb/s, 30 fps, 1k tbn
    Metadata:
      alpha_mode      : 1
      encoder         : Lavc59.1.100 libvpx-vp9
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=   20 fps=0.0 q=0.0 Lsize=       2kB time=00:00:00.63 bitrate=  21.5kbits/s speed=1.09x
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 68.316833%


    


    an playback of the webm file in vlc shows something totaly different, the area of the cross is filled in its color and the rest is white where it all should be black and transparent if possible (yes i know in vlc it's not possible...) :
    
out.webm in vlc shows an block instead of the a green or blue cross

    


    It would be nice to have an ffmpeg command that does produce the expected result (webm video showing a cross on black/transparent background)

    


    PS : Related to the Title of this post : I don't know how this issue is called, so feel free to edit the Title, im out of ideas.