Recherche avancée

Médias (91)

Autres articles (84)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

Sur d’autres sites (9773)

  • Bash script : automate ffmpeg encoding for mpeg-dash

    13 février 2018, par Massimo Vantaggio

    I’m writing a bash file to create video encoding and concatenation for dash live streaming use,
    Basically it read an input video folder, encodes all videos into three resolution formats, after that it concatening them to create three adaption sets.

    DIAGRAM :

    enter image description here

    This script checks for fps conformance,

    force/scaling resolution if the input is not 1920 x 1080p,

    Insert the channel logo png,

    Cut the end of all videos input in order to make them finish with closed gop, this to ensure that there are not videos with audio and video track with different lenght.

    ISSUE :

    Actually I’m not sure that the concatenation process respects the closed GOP alignment as it after the encoding..
    I try to cut also the end of the concatenation result in order to make it finish without decimals on a closed gop too, but im unable to erase all decimals from the total duration :

    total duration in seconds: 826.795000
    total duration corrected in seconds: 826

    But the real duration measured by ffprobe is

    824.044000

    I try to check keyframes alignment with mp4box has they teach without any result :

    MP4Box -info TRACK_ID source1.mp4 2>&1 | grep GOP

    This is the first time that i work with "video scripts" and probably i don’t know what input to give for TRACK_ID

    BASH SCRIPT :

    #!/bin/bash
    #CANCAT 0.2

    cd input
    times=()
    fps=()
    for f in *.mp4; do

       _t=$(ffprobe -i "$f" -show_entries format=duration -v quiet -of csv="p=0")
       times+=("$_t")

       _f=$(ffmpeg -i "$f" 2>&1 | sed -n "s/.*, \\(.*\\) fp.*/\\1/p")
       fps+=("$_f")
    done
    #SUM ALL DURATIONS
    TOTALDURATION=$( echo "${times[@]}" | sed 's/ /+/g' | bc )
    #DELETE DECIMAL
    DURROUND=$(echo "$TOTALDURATION" | cut -d'.' -f1)
    #GET REST OF DIVISION BY 2 AS GOP
    TOTDELTA="$((DURROUND%2))"
    #SUBTRACT DELTA FROM TOTAL DURATION
    TOTDUR="$(($DURROUND-$TOTDELTA))"

    #GET NUMBER OF ELEMENTS IN FPS ARRAY  
    tLen=${#fps[@]}
    #CHECK FPS EQUALITY    
    for tLen in "${fps[@]:1}"; do
       if [[ $tLen != ${fps[0]} ]]; then
           printf "WARNING: VIDEO’S FRAME-RATE ARE NOT EQUALS, THE PROCESS CAN’T START."
           printf "%s\\0" "${fps[@]}" |
               sort -zu |
               xargs -0 printf " %s"
           printf "\\n"
          exit 1
       fi
    done
    for f in *.mp4; do
    #GET DURATION OF EACH VIDEO
    DUR="$(ffprobe -i "$f" -show_entries format=duration -v quiet -of csv="p=0")"
    DUR=$(echo "$DUR" | cut -d'.' -f1) # DELETE DECIMAL
    #GET FPS OF EACH VIDEO
    FPS="$(ffmpeg -i "$f" 2>&1 | sed -n "s/.*, \(.*\) fp.*/\1/p")"
    #ROUND FPS OF EACH VIDEO
    FPSC=$( echo "($FPS+0.5)/1" | bc )
    #REMOVE EXTENSION FROM VIDEO FILE NAME
    NAME=$(echo "$f" | cut -d'.' -f1)

    #GET GOP
    GOP="$((FPSC*2))"
    DELTADUR="$((DUR%2))"
    DUR="$(($DUR-$DELTADUR))"

    #ENCODE 1080p
    ffmpeg -y -i "$f" -i ../logo/logo.png -c:a aac -b:a 384k -ar 48000 -ac 2 -async 1 -c:v libx264 -x264opts keyint=$GOP:min-keyint=$GOP:no-scenecut -bf 0 -r $FPSC -b:v 4800k -maxrate 4800k -bufsize 3000k -profile:v main -crf 22 -t $DUR -filter_complex "[0:v][1:v]overlay=main_w-overlay_w-10:10,scale=1920:1080,setsar=1" ../buffer/${NAME}-1080.mp4

    #ENCODE 720p
    ffmpeg -y -i ../buffer/${NAME}-1080.mp4 -c:a aac -b:a 256k -ar 48000 -ac 2 -async 1 -c:v libx264 -x264opts keyint=$GOP:min-keyint=$GOP:no-scenecut -bf 0 -s 1280x720 -r $FPSC -b:v 2400k -maxrate 2400k -bufsize 1500k -profile:v main -crf 22 -t $DUR ../buffer/${NAME}-720.mp4

    #ENCODE 360p
    ffmpeg -y -i ../buffer/${NAME}-720.mp4 -c:a aac -b:a 128k -ar 48000 -ac 2 -async 1 -c:v libx264 -x264opts keyint=$GOP:min-keyint=$GOP:no-scenecut -bf 0 -s 640x360 -r $FPSC -b:v 800k -maxrate 800k -bufsize 500k -profile:v main -crf 22 -t $DUR ../buffer/${NAME}-360.mp4
    done


    #enter in buffer
    cd ..
    cd buffer

    #CONCAT 1080 SET
    # with a bash for loop
    for f in ./*1080.mp4; do echo "file '$f'" >> 1080list.txt; done

    ffmpeg -f concat -safe 0 -i 1080list.txt -t $TOTDUR -c copy ../output/1080set.mp4

    #CONCAT 720 SET
    # with a bash for loop
    for f in ./*720.mp4; do echo "file '$f'" >> 720list.txt; done

    ffmpeg -f concat -safe 0 -i 720list.txt -t $TOTDUR -c copy ../output/720set.mp4

    #CONCAT 360 SET
    # with a bash for loop
    for f in ./*360.mp4; do echo "file '$f'" >> 360list.txt; done

    ffmpeg -f concat -safe 0 -i 360list.txt -t $TOTDUR -c copy ../output/360set.mp4

    #CLEAN BUFFER
    rm *.mp4
    rm *.txt

    echo "CONCAT COMPLETED:"
    echo "frame-rate: $fps"
    echo "total duration in seconds: $TOTALDURATION"
    echo "total duration corrected in seconds: $TOTDUR"

    The full file with relative folders :

    BASH SCRIPT WITH FOLDERS

    RESULT VIDEO

    There is someone who can help me to understand why I can not eliminate the decimals of the total duration during concat ?
    And how to check overall keyframes allignment ?
    Also any impovement that i ignore is welcome !

    Thanks a lot !

    Massimo

  • Compressing a Video for HLS Streaming

    12 mars 2018, par jAndy

    I’m in the situation where I have a source file (very high quality, direct output from FCPX) which is in 1080p resolution.

    I use ffmpeg to create a 240, 360, 480 and 720 version to have an adaptive stream quality via HLS, so far so good. My question is about the strategy I’m using.
    Right now, I always use the original file as input for ffmpeg. I was wondering if it wouldn’t be a better idea to convert from 1080 to 720 with full compression algorithms and after that, just re-scale from 720 to 480, 360 and 240.

    I’m not really into video compression and ffmpeg, so I’d just like to hear some expert opinions on this approach. Is there any advantage to always go "all the way" (original file -> compressed/rescaled file) ?

  • ffmpeg : concat and encode with one command

    15 mars 2018, par Massimo Vantaggio

    I have a script that automates encode and concat a series of input video files.
    I’m trying to get encode and concat in a single command.

    At the moment it does not work causing immense empty pauses in the final video output.

    I would like to get the result with concat demux instead of concat protocol because it is much harder to automate in a script

    Do you know if it is possible to archive this result with concat demux ?
    Thanks a lot !

    Massimo

    ENCODE / CONCAT 1080p

    for f in ./*.mp4; do echo "file '$f'" >> list.txt; done

    ffmpeg -f concat -safe 0 -y -i list.txt -i ../logo/logo.png -c:a aac -b:a 384k -ar 48000 -ac 2 -af aresample=async=1000 -c:v libx264 -x264opts keyint=50:min-keyint=50:no-scenecut -bf 0 -r 25 -b:v 4800k -maxrate 4800k -bufsize 3000k -profile:v main -crf 22 -filter_complex "[0:v][1:v]overlay=main_w-overlay_w-10:10,scale=1920:1080,setsar=1" ../buffer/1080set.mp4

    It seems to add long pause at low frame-rate :

    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb03f05e600] Auto-inserting h264_mp4toannexb bitstream filter

    frame= 9745 fps= 13 q=27.0 size= 186368kB time=00:18:52.56 bitrate=1348.0kbits

    frame= 9745 fps= 13 q=27.0 size= 186368kB time=00:18:56.57 bitrate=1343.3kbits/

    frame= 9745 fps= 13 q=27.0 size= 186368kB time=00:19:00.65 bitrate=1338.5kbits/

    frame= 9745 fps= 13 q=27.0 size= 186368kB time=00:19:02.29 bitrate=1336.5kbits/

    More than 1000 frames duplicated

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       creation_time   : 2016-02-27T22:25:49.000000Z
       encoder         : HandBrake 0.10.5 2016021100
     Duration: 00:06:29.87, start: 0.000000, bitrate: 3447 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 768x432, 3282 kb/s, 25 fps, 25 tbr, 90k tbn, 180k tbc (default)
       Metadata:
         creation_time   : 2016-02-27T22:25:49.000000Z
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 159 kb/s (default)
       Metadata:
         creation_time   : 2016-02-27T22:25:49.000000Z
         handler_name    : Stereo

    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '2.mp4':
     Metadata:
       major_brand     : M4V
       minor_version   : 1
       compatible_brands: M4V mp42isom
       creation_time   : 2016-02-27T18:52:37.000000Z
     Duration: 00:07:16.93, start: 0.000000, bitrate: 1184 kb/s
       Stream #1:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 768x432, 991 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
       Metadata:
         creation_time   : 2016-02-27T18:52:37.000000Z
         handler_name    : Mainconcept MP4 Video Media Handler
         encoder         : AVC Coding
       Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
       Metadata:
         creation_time   : 2016-02-27T18:52:37.000000Z
         handler_name    : Mainconcept MP4 Sound Media Handler

    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '3.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42mp41
       creation_time   : 2017-06-27T17:58:17.000000Z
     Duration: 00:05:05.05, start: 0.000000, bitrate: 2622 kb/s
       Stream #2:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 768x432, 2301 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
       Metadata:
         creation_time   : 2017-06-27T17:58:17.000000Z
         handler_name    : Alias Data Handler
         encoder         : AVC Coding
       Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
       Metadata:
         creation_time   : 2017-06-27T17:58:17.000000Z
         handler_name    : Alias Data Handler

    Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '4.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42mp41
       creation_time   : 2017-06-27T17:53:32.000000Z
     Duration: 00:06:47.36, start: 0.000000, bitrate: 3144 kb/s
       Stream #3:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 768x432, 2819 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
       Metadata:
         creation_time   : 2017-06-27T17:53:32.000000Z
         handler_name    : Alias Data Handler
         encoder         : AVC Coding
       Stream #3:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
       Metadata:
         creation_time   : 2017-06-27T17:53:32.000000Z
         handler_name    : Alias Data Handler