Recherche avancée

Médias (91)

Autres articles (80)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • 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" ;

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

Sur d’autres sites (6664)

  • Increased File Size When Converting MP4 to WebM using FFmpeg

    23 décembre 2024, par kimgijeong

    I am using FFmpeg to convert MP4 to WebM with the following command :

    


    ffmpeg -y -hide_banner -nostats \
-f mov,mp4,m4a,3gp,3g2,mj2 -i "http://127.0.0.1:80/lotteon-low-bitrate.mp4" \
-threads auto -f webm -acodec libopus -b:a 96.059k -vcodec libsvtav1 -preset 11 -pix_fmt yuv420p \
-vf "scale='min(-1, iw)':'min(-1,ih)':force_original_aspect_ratio=decrease,crop=trunc(iw/2)*2:trunc(ih/2)*2" \
"/usr/local/m2/m2temp/xcdrtmp/2052_1.webm"


    


    However, the output webm file size is larger than the source MP4 file. For example :

    


      

    • Source MP4 : 4.6 MB (bit rate : 994,053 bps)

      


    • 


    • Output WebM : 16 MB (bit rate : 3,902,037 bps)

      


    • 


    


    I know SVT-AV1 encoder defaults to CRF mode. Due to not specifying the bitrate explicitly, the SVT-AV1 encoder automatically sets the bit_rate. It appears that the encoder is setting it to a much higher value (3,323,104 bps), causing the increase in file size compared to the source MP4 (994,053 bps). Here are the methods i tried to reduce the WebM file size compared to the source MP4 :

    


      

    1. -b:v 994k
    2. 


    


    I tried to match the target bitrate with the source MP4's bitrate to reduce the output size, but encountered the following error :

    


    Svt[error]: Instance 1: Force key frames is not supported for VBR mode Last message r
epeated 2 times [libsvtav1 @ 0x239dd100] Error setting encoder parameters: bad parameter (0x80001005)


    


    Looking at the official documentation, this mode change (from CRF to VBR when setting a target bitrate) appears to be expected behavior. However, the error is puzzling since I haven't set any force keyframe parameters in the FFmpeg command.

    


      

    1. svtav1-params "mbr=994k"
    2. 


    


    The second method i tried was using the svtav1-params "mbr=994k" option to set the maxrate while maintaining CRF mode This method showed some improvement, but the output file size was still larger than the source MP4.

    


      

    • Output WebM : 5MB (bit rate : 1,209,877 bps)
    • 


    


    The more critical reason why we can't adopt the second method (using svtav1-params "mbr=994k") is that even for the same MP4 source file, the output file size varies slightly with each encoding.

    


      

    1. -b:v 994k -svtav1-params “rc=2:pred-struct=1”(CBR, low delay)
    2. 


    


    The final method I tried was setting the target bitrate while using CBR (Constant Bit Rate) and low-delay mode The default value for pred-structure is 2(random access), but I had to use low-delay mode due to the following error :

    


    Svt[error]: CBR Rate control is currently not supported for SVT_AV1_PRED_RANDOM_ACCESS, use VBR mode


    


    This way was the only approach among those i tried that successfully reduced the output size.

    


      

    • Output WebM : 4.3MB (bit rate : 1,032,373 bps)
    • 


    


    In summary, I have three questions about this MP4 to WebM conversion issue :

    


      

    1. When setting the target bitrate with -b:v 994k, the switch to VBR mode is expected behavior. However, why does the force keyframe error occur when we haven't explicitly set any force keyframe parameters ?

      


    2. 


    3. Why does the output WebM file size fluctuate when setting maxrate either through -maxrate or svtav1-params "mbr=994k", even when using the same MP4 source file ?

      


    4. 


    5. Besides using -b:v 994k -svtav1-params "rc=2:pred-struct=1" (CBR with low delay), are there any other methods that can guarantee a WebM output size smaller than the source MP4 when converting from MP4 to WebM ?

      


    6. 


    


    I am using a recent version of the SVT-AV1 codec :

    


    Svt[info]: SVT [version]:       SVT-AV1 Encoder Lib 58146ca
Svt[info]: SVT [build]  :       GCC 11.5.0 20240719 (Red Hat 11.5.0-2)   64 bit
Svt[info]: LIB Build date: Oct 28 2024 07:40:59
ffmpeg video svt-av1


    


  • How do I get drawtext filter in ffmpeg to work on ubuntu 22.04 ?

    3 décembre 2024, par chovy

    Here's my script, but no matter what I try the drawtext filter is not enabled :

    


    #!/bin/bash

set -e  # Exit on any error

# Define installation directories
INSTALL_DIR="$HOME/ffmpeg_build"
BIN_DIR="$HOME/bin"
SOURCE_DIR="$HOME/ffmpeg_sources"
NUM_CORES=$(nproc)

echo "Creating necessary directories..."
mkdir -p "$INSTALL_DIR" "$BIN_DIR" "$SOURCE_DIR"

# Install required tools and dependencies
echo "Installing build tools and essential libraries..."
sudo apt-get update
sudo apt-get install -y \
  autoconf automake build-essential cmake git-core libass-dev \
  libfreetype6-dev libsdl2-dev libtool libva-dev libvdpau-dev \
  libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev \
  meson ninja-build pkg-config texinfo wget yasm zlib1g-dev \
  nasm libnuma-dev libfdk-aac-dev libmp3lame-dev libopus-dev \
  libfreetype6 libdrm-dev mercurial

# Remove system-installed x264 and x265 to prevent conflicts
sudo apt-get remove -y libx264-dev libx265-dev x264 x265

# Build dependencies
cd "$SOURCE_DIR"

# Install libx264 (static)
if [ ! -d "$SOURCE_DIR/x264" ]; then
  echo "Building and installing libx264..."
  git clone --branch stable --depth 1 https://code.videolan.org/videolan/x264.git
  cd x264
  make distclean || true
  ./configure --prefix="$INSTALL_DIR" --enable-static --disable-opencl
  make -j$NUM_CORES
  make install
  cd "$SOURCE_DIR"
fi

# Install libx265 (static)
if [ ! -d "$SOURCE_DIR/x265" ]; then
  echo "Building and installing libx265..."
  git clone --depth 1 https://github.com/videolan/x265.git
  cd x265/build/linux
  cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
    -DENABLE_SHARED=OFF -DENABLE_PIC=ON -DENABLE_PKGCONFIG=ON ../../source
  make -j$NUM_CORES
  make install
  cd "$SOURCE_DIR"
fi

# Install libvpx (static)
if [ ! -d "$SOURCE_DIR/libvpx" ]; then
  echo "Building and installing libvpx..."
  git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
  cd libvpx
  ./configure --prefix="$INSTALL_DIR" --disable-examples --disable-unit-tests \
    --enable-vp9-highbitdepth --as=yasm --enable-static --enable-pic
  make -j$NUM_CORES
  make install
  cd "$SOURCE_DIR"
fi

# Install libopus (static)
if [ ! -d "$SOURCE_DIR/opus" ]; then
  echo "Building and installing libopus..."
  git clone --depth 1 https://github.com/xiph/opus.git
  cd opus
  ./autogen.sh
  ./configure --prefix="$INSTALL_DIR" --disable-shared
  make -j$NUM_CORES
  make install
  cd "$SOURCE_DIR"
fi

# Install libaom (static)
if [ ! -d "$SOURCE_DIR/aom" ]; then
  echo "Building and installing libaom..."
  git clone --depth 1 https://aomedia.googlesource.com/aom
  mkdir -p aom_build
  cd aom_build
  cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
    -DBUILD_SHARED_LIBS=0 -DENABLE_NASM=1 -DCMAKE_C_FLAGS="-fPIC" ../aom
  make -j$NUM_CORES
  make install
  cd "$SOURCE_DIR"
fi

# Build and install FFmpeg
echo "Building and installing FFmpeg..."
cd "$SOURCE_DIR"
if [ ! -d "$SOURCE_DIR/ffmpeg" ]; then
  git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg
  cd ffmpeg
else
  cd ffmpeg
  git pull
fi

export PKG_CONFIG_PATH="$INSTALL_DIR/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:/usr/lib/$(uname -m)-linux-gnu/pkgconfig:$PKG_CONFIG_PATH"

make distclean

./configure \
  --prefix="$INSTALL_DIR" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I$INSTALL_DIR/include" \
  --extra-ldflags="-L$INSTALL_DIR/lib" \
  --extra-libs="-lpthread -lm" \
  --bindir="$BIN_DIR" \
  --enable-gpl \
  --enable-nonfree \
  --enable-libfreetype \
  --enable-libx264 \
  --enable-libvpx \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libass \
  --enable-libvorbis \
  --enable-libaom \
  --enable-libdrm \
  --enable-version3 \
  --enable-static \
  --disable-shared \
  --enable-small
  
make -j$NUM_CORES
make install

# Add ffmpeg to PATH
echo "export PATH=\"$BIN_DIR:\$PATH\"" >> "$HOME/.bashrc"
source "$HOME/.bashrc"

# Final checks
echo "FFmpeg installation complete. Verifying installation..."
ffmpeg -version



    


    Here is my buildconf which appears correct :

    


    $ ffmpeg -buildconf  

ffmpeg version N-117989-gcb27e478f7 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: --prefix=/usr/local --extra-cflags=-I/home/ubuntu/src/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/src/ffmpeg_build/lib --bindir=/usr/local/bin --enable-gpl --enable-nonfree --enable-libfreetype --enable-libx264 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libass --enable-libvorbis --enable-libaom --enable-libdrm --enable-version3 --enable-shared --enable-filter=drawtext  libavutil      59. 47.101 / 59. 47.101  libavcodec     61. 26.100 / 61. 26.100  libavformat    61.  9.100 / 61.  9.100  libavdevice    61.  4.100 / 61.  4.100  libavfilter    10.  6.101 / 10.  6.101  libswscale      8. 12.100 /  8. 12.100  libswresample   5.  4.100 /  5.  4.100
  libpostproc    58.  4.100 / 58.  4.100

  configuration:    --prefix=/usr/local
    --extra-cflags=-I/home/ubuntu/src/ffmpeg_build/include
    --extra-ldflags=-L/home/ubuntu/src/ffmpeg_build/lib
    --bindir=/usr/local/bin
    --enable-gpl    --enable-nonfree    --enable-libfreetype    --enable-libx264    --enable-libvpx    --enable-libmp3lame    --enable-libopus    --enable-libass    --enable-libvorbis    --enable-libaom    --enable-libdrm    --enable-version3    --enable-shared    --enable-filter=drawtext


    


    However the filter drawtext is not enabled :

    


    $ ffmpeg -filters | grep drawtext
ffmpeg version N-117989-gcb27e478f7 Copyright (c) 2000-2024 the FFmpeg developers  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)  configuration: --prefix=/usr/local --extra-cflags=-I/home/ubuntu/src/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/src/ffmpeg_build/lib --bindir=/usr/local/bin --enable-gpl --enable-nonfree --enable-libfreetype --enable-libx264 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libass --enable-libvorbis --enable-libaom --enable-libdrm --enable-version3 --enable-shared --enable-filter=drawtext  libavutil      59. 47.101 / 59. 47.101  libavcodec     61. 26.100 / 61. 26.100  libavformat    61.  9.100 / 61.  9.100  libavdevice    61.  4.100 / 61.  4.100  libavfilter    10.  6.101 / 10.  6.101  libswscale      8. 12.100 /  8. 12.100  libswresample   5.  4.100 /  5.  4.100  libpostproc    58.  4.100 / 58.  4.100


    


  • Converting HLS Stream to stream supported by old radio

    29 novembre 2024, par Alberto Faenza

    I have an old internet radio that does not support HLS streams.
Therefore I cannot listen to my favourite radio at this url :
https://streamcdnf31-4c4b867c89244861ac216426883d1ad0.msvdn.net/radiodeejay/radiodeejay/master_ma.m3u8

    


    I found a solution using a paid software https://minimradio.com/ which is based on minimserver and minimstreamer.

    


    This solution works if I install mininmserver and minimstreamer on a local computer and use the internet radio to point to the converter stream but I will have to pay if I want to use this.

    


    Checking the documentation of minimradio and ministreamer I can see the following :

    


    *Some internet radios can play the previous AAC ADTS streams but can't play these new HLS streams
...

    


    If the network stream URL points to an HLS .m3u8 master playlist or media playlist file, MinimStreamer reads this file and uses the HLS protocol to read the stream audio data and send it to the music player as a conventional HTTP stream. This makes the stream playable on music players that don't support the HLS protocol. The audio data in the stream must be encoded in AAC format.*
and not a single destination receiver I should use a streaming (broadcasting) server. What can I use to do that ?

    


    My question is the following :
Is there a way to replicate what minimstreamer is doing using ffmpeg ?
I have tried this :

    


    


    ffmpeg -re -i https://streamcdnf31-4c4b867c89244861ac216426883d1ad0.msvdn.net/radiodeejay/radiodeejay/master_ma.m3u8 -c copy -listen 1 -f mpegts http://192.168.1.9:10000

    


    


    which is playing corrctly in local vlc on the same computer. But when I stop VLC is got this error in ffmpeg :

    


    [https @ 00000291de047400] Cannot reuse HTTP connection for different host: StreamCdnG20-4c4b867c89244861ac216426883d1ad0.msvdn.net:-1 != 4c4b867c89244861ac216426883d1ad0.msvdn.net:-1
[hls @ 00000291dd96d140] keepalive request failed for 'https://4c4b867c89244861ac216426883d1ad0.msvdn.net/radiodeejay/radiodeejay/play1.m3u8' with error: 'Invalid argument' when parsing playlist
[hls @ 00000291dd96d140] Opening 'https://4c4b867c89244861ac216426883d1ad0.msvdn.net/radiodeejay/radiodeejay/play1.m3u8' for reading
[hls @ 00000291dd96d140] Skip ('#EXT-X-DISCONTINUITY-SEQUENCE:0')
[hls @ 00000291dd96d140] Skip ('#EXT-X-PROGRAM-DATE-TIME:2024-11-29T06:36:56.926Z')
[hls @ 00000291dd96d140] Skip ('#EXT-X-PROGRAM-DATE-TIME:2024-11-29T06:37:07.314Z')
[hls @ 00000291dd96d140] Skip ('#EXT-X-PROGRAM-DATE-TIME:2024-11-29T06:37:17.571Z')
[https @ 00000291de4e00c0] Opening 'https://StreamCdnG20-4c4b867c89244861ac216426883d1ad0.msvdn.net/radiodeejay/radiodeejay/20240722T095729_p1s_001086632.ts' for reading
[aost#0:0/copy @ 00000291de1c4f40] Error submitting a packet to the muxer: Error number -10054 occurred
    Last message repeated 1 times
[out#0/mpegts @ 00000291deaa7e40] Error muxing a packet
[out#0/mpegts @ 00000291deaa7e40] Task finished with error code: -10054 (Error number -10054 occurred)
[out#0/mpegts @ 00000291deaa7e40] Terminating thread with return code -10054 (Error number -10054 occurred)
[out#0/mpegts @ 00000291deaa7e40] Error writing trailer: Error number -10054 occurred
[http @ 00000291de8870c0] URL read error: Error number -10054 occurred
[out#0/mpegts @ 00000291deaa7e40] Error closing file: Error number -10054 occurred
[out#0/mpegts @ 00000291deaa7e40] video:0KiB audio:797KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 21.849292%
size=     971KiB time=00:00:50.98 bitrate= 156.0kbits/s speed=1.01x
Conversion failed!


    


    And if I try to connect from my internet radio I immediately got this error :

    


    [aost#0:0/copy @ 0000027081584a40] Error submitting a packet to the muxer: Error number -10053 occurred
    Last message repeated 1 times
[out#0/mpegts @ 0000027081e684c0] Error muxing a packet
[out#0/mpegts @ 0000027081e684c0] Task finished with error code: -10053 (Error number -10053 occurred)
[out#0/mpegts @ 0000027081e684c0] Terminating thread with return code -10053 (Error number -10053 occurred)
[out#0/mpegts @ 0000027081e684c0] Error writing trailer: Error number -10053 occurred
[http @ 0000027081c47680] URL read error: Error number -10053 occurred
[out#0/mpegts @ 0000027081e684c0] Error closing file: Error number -10053 occurred
[out#0/mpegts @ 0000027081e684c0] video:0KiB audio:46KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 13.917515%
size=      52KiB time=00:00:02.94 bitrate= 145.1kbits/s speed= 1.2x
Conversion failed!


    


    What is the correct way to stream this one locally in order to be listened in my internet radio ?
Shall I use ffmpeg or can be done directly with ngnix ? Or shall I use both ?