Recherche avancée

Médias (3)

Mot : - Tags -/plugin

Autres articles (97)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

Sur d’autres sites (10533)

  • 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

  • Stack AVFrame side by side (libav/ffmpeg)

    22 février 2018, par dronemastersaga

    So I am trying to combine two H264 livestreams of 1920x1080 resolution side-by-side to a livestream of 3840x1080 resolution.

    For this, I can decode streams to AVFrames in libav/FFmpeg that I would like to combine into a bigger frame. The Input AVFrames : Two 1920x1080 frames in NV12 format (description : planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V))

    The way I have figured out is with colorspace conversion (YUV to BGR) in libav, then to change it to OpenCV Mat, then to use hconcat in OpenCV to stack together, then colorspace conversion (BGR to YUV) in AVFormat.

    Below is the method currently being used :

    //Prior code is too long: Basically it decodes 2 streams to AVFrames frame1 and frame2 in a loop
    sws_scale(swsContext, (const uint8_t *const *) frame1->data, frame1->linesize, 0, 1080, (uint8_t *const *) frameBGR1->data, frameBGR1->linesize);
    sws_scale(swsContext, (const uint8_t *const *) frame2->data, frame2->linesize, 0, 1080, (uint8_t *const *) frameBGR2->data, frameBGR2->linesize);
    Mat matFrame1(1080, 1920, CV_8UC3, frameBGR1->data[0], (size_t) frameBGR1->linesize[0]);
    Mat matFrame2(1080, 1920, CV_8UC3, frameBGR2->data[0], (size_t) frameBGR2->linesize[0]);
    Mat fullFrame;
    hconcat(matFrame1, matFrame2, fullFrame);
    const int stride[] = { static_cast<int>(fullFrame.step[0]) };
    sws_scale(modifyContext, (const uint8_t * const *)&amp;fullFrame.data, stride, 0, fullFrame.rows, newFrame->data, newFrame->linesize);
    //From here, newFrame is sent to the encoder
    </int>

    The resulting image is satisfactory but it does lose quality in colorspace conversion. However this method is too slow to use (I’m at 15 fps and I need 30). Is there a way to stack AVFrames directly without colorspace conversion ? Or is there any better way to do this ? I searched a lot about this and I couldn’t find any solution to this. Please advise.

  • FFMPEG, resize and pad a video by and odd number of pixels ?

    18 février 2018, par Jules

    I’m trying to resize and pad a video from 1917 x 1080 to 1920 x 1080.

    I’ve tried various syntax, which works but doesn’t change the size.

    ffmpeg -i input.mp4 -filter:v scale=1920:1080,pad=1920:1080 -c:a copy output.mp4

    However, I have go to this point by resize, joint audio and rotate. The initial size is 640 x 1136, I believe this is the source of the problem.

    ffmpeg -i input.mp4 -filter:v scale=900:1200 -c:a copy output.mp4

    ffmpeg \
    -i input.m4a \
    -i resize.mp4 -acodec copy -vcodec copy -shortest \
    output.mp4

    ffmpeg -i input.mp4" -vf "transpose=2" output/mp4

    So I’m wondering if I should do something different earlier