Recherche avancée

Médias (91)

Autres articles (87)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • 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 (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (11501)

  • Elastic Transcoder output duration doesnt match with the sum of my Input duration

    28 mars 2019, par auricless

    I have multiple media file to concatenate into a single video file. Composed of different media types including video, audio and image. I use FFMPEG to convert audio and images to a video then finally, will use Elastic Transcoder to stitch/concatenate the video files in a single one. On creating transcoder job, whenever I placed the input video which is originally an image, converted by FFMPEG, to be the last input in order, it shrinks the duration of its exposure in the final output by 5 seconds whenever its original duration is > 5. This happens only with that condition.

    Example :
    (1) video1 - 10s
    (2) image1 - 10s
    (3) video2 - 15s
    (4) image2 - 20s
    output : video - 40s
    (image2’s duration or exposure in the output shrinks to approx. 5s)

    Clearly, the sum of Input duration and the Output duration does not match. It is even explicitly stated on the Job result of elastic transcoder.


    Thought I had a wrong conversion settings in FFMPEG so I changed some options. After some changes and comparing the image converted to video (V1) with an authentic video to stitch with (V2), their settings are almost the same. In this I use ffmpeg -i myVideo.mp4 to check its details. They differ only on SAR, DAR, tbr and tbn and I dont really know what are their use.

    Already checked the duration of the converted images after ffmpeg conversion and it is accurate, it only messed up after feeding it to the elastic transcoder and placed as the last input.

    Here is my conversion command with FFMPEG(image to video) :
    ffmpeg -r 29.97 -i [input.jpg] -f lavfi -i anullsrc=r=48000:cl:stereo -t [duration] -acodec aac -vcodec libx264 -profile:v baseline -pix_fmt yuv420p -t [duration] -vf scale=854:480 -strict -2 [output.mp4]

    The expected result should be that the output file is consistent with the actual duration it has.

    [EDIT]

    Here’s real videos I feed on Elastic Transcoder using ffprobe filename :

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'clip2.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.71.100
     Duration: 00:00:10.05, start: 0.042667, bitrate: 476 kb/s
       Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
       Stream #0:1(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 854x480 [SAR 2136:2135 DAR 89:50], 341 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'image2.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf56.12.100
     Duration: 00:02:10.03, start: 0.033333, bitrate: 130 kb/s
       Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 854x480 [SAR 1943:1004 DAR 829661:240960], 2636 kb/s, SAR 283440:146461 DAR 1181:343, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
  • ffmpeg Input link in1:v0 parameters do not match the corresponding output link in0:v0 parameters

    13 décembre 2017, par Anuj TBE

    I’m using ffmpeg to generate slideshow with images input from web

    ffmpeg  \
    -loop 1 -t 5 -i https://eample.com/image_1.jpg \
    -loop 1 -t 5 -i https://eample.com/image_2.jpg \
    -loop 1 -t 5 -i https://eample.com/image_3.jpg \
    -loop 1 -t 5 -i https://eample.com/image_4.jpg \
    -loop 1 -t 5 -i https://eample.com/image_5.jpg \
    -filter_complex \
    "[0:v]setdar=16/9,fade=t=out:st=4:d=1[v0]; \
    [1:v]setdar=16/9,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v1]; \
    [2:v]setdar=16/9,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v2]; \
    [3:v]setdar=16/9,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v3]; \
    [4:v]setdar=16/9,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v4]; \
    [v0][v1][v2][v3][v4]concat=n=5:v=1:a=0,format=yuv420p[v]" -map "[v]" out.mp4

    But after processing the videos, it gives error as

    [Parsed_concat_14 @ 0x3e5e9e0] Input link in1:v0 parameters (size 1024x709, SAR 709:576) do not match the corresponding output link in0:v0 parameters (500x281, SAR 1124:1125)
    [Parsed_concat_14 @ 0x3e5e9e0] Failed to configure output pad on Parsed_concat_14
    Error configuring complex filters.
    Invalid argument

    Is it related to scaling of images, since images could be different dimensions.

    Also, how to scale the images to fit 16:9 ratio may be using crop or fit ?

  • ffmpeg : match audio video duration post concatenation

    20 janvier 2020, par Massimo Vantaggio

    I wrote this bash to automate concatentation of videos for dash mpeg streaming infinite loop.
    Im unable to obtain same duration for audio and video, with the videos that i’m using for testing i get always 6 ms more for audio track.
    May ask help to debug it and understand how to get same duration for both audio and video track ?

    #!/bin/bash
    #CANCAT 0.3

    cd input
    fps=()
    # GET FPS OF EACH VIDEO INTO ARRAY
    for f in *.mp4; do
       _f=$(ffmpeg -i "$f" 2>&1 | sed -n "s/.*, \\(.*\\) fp.*/\\1/p")
       fps+=("$_f")
    done

    #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

    #AUDIO ENCODING
    for f in *.mp4;
    do
    NAME=$(echo "$f" | cut -d'.' -f1)
    ffmpeg -y -i "$f" -c copy -video_track_timescale 90k -c:a aac -b:a 384k -ar 44100 -ac 2 -shortest -af aresample=async=1 ../buffer/${NAME}_buffer.mp4
    done
    #-af aresample=async=1000
    #-filter_complex " [1:0] apad "

    cd ..
    cd buffer
    times=()
    for f in *.mp4;
    do
    echo "file '$f'" >> list.txt;

    # GET DURATION OF EACH VIDEO
    _t=$(ffprobe -i "$f" -show_entries format=duration -v quiet -of csv="p=0")
    times+=("$_t")
    done

    #SUM ALL DURATIONS
    TOTALDURATION=$( echo "${times[@]}" | sed 's/ /+/g' | bc )
    DURROUND=$(echo "$TOTALDURATION" | cut -d'.' -f1)
    TOTDELTA="$((DURROUND%2))"
    TOTDUR="$(($DURROUND-$TOTDELTA))"

    #GET FPS
    FPS="$(ffmpeg -i ${f[0]} 2>&1 | sed -n "s/.*, \(.*\) fp.*/\1/p")"
    #ROUND FPS
    FPSC=$( echo "($FPS+0.5)/1" | bc )
    #GET GOP
    GOP="$((FPSC*2))"

    #ENCODING MASTER TRACK
    ffmpeg -f concat -safe 0 -y -i list.txt -loop 1 -i ../logo/logo.png -c:a copy -c:v libx264 -x264opts keyint=$GOP:min-keyint=$GOP:no-scenecut -bf 0 -r $FPSC -b:v 4800k -maxrate 9600k -bufsize 19200k -profile:v main -crf 22 -filter_complex "[0:v][1:v]overlay=main_w-overlay_w-10:10,scale=1920:1080,setsar=1" -t $TOTDUR 1080set.mp4

    #EXTRACTING AUDIO FROM MASTER VIDEO TRACK
    ffmpeg -y -i 1080set.mp4 -c copy -vn ../output/output_audio.mp4

    #REMOVE AUDIO FROM MASTER VIDEO TRACK
    ffmpeg -y -i 1080set.mp4 -c copy -an ../output/output_1080.mp4

    #CLEAN BUFFER
    rm *.mp4
    rm *.txt

    cd ..
    cd output

    #ENCODE 720p
    ffmpeg -y -i output_1080.mp4 -an -c:v libx264 -x264opts keyint=$GOP:min-keyint=$GOP:no-scenecut -bf 0 -s 1280x720 -r $FPSC -b:v 2400k -maxrate 4800k -bufsize 9600k -profile:v main -crf 22 output_720.mp4

    #ENCODE 360p
    ffmpeg -y -i output_1080.mp4 -an -c:v libx264 -x264opts keyint=$GOP:min-keyint=$GOP:no-scenecut -bf 0 -s 640x360 -r $FPSC -b:v 800k -maxrate 1600k -bufsize 3200k -profile:v main -crf 22 output_360.mp4

    #VALIDATOR
    echo 1080p ENCODING
    echo GOP:   $GOP
    echo VIDEO FORMAT CONTAINER DURATION:  
    ffprobe -v error -show_entries format=duration \
     -of default=noprint_wrappers=1:nokey=1 output_1080.mp4
    echo VIDEO STREAM DURATION:
    ffprobe -v error -select_streams v:0 -show_entries stream=duration \
     -of default=noprint_wrappers=1:nokey=1 output_1080.mp4
    echo AUDIO FORMAT CONTAINER DURATION:  
    ffprobe -v error -show_entries format=duration \
     -of default=noprint_wrappers=1:nokey=1 output_audio.mp4

    echo ______________________________________________________________

    echo 720p ENCODING
    echo GOP:   $GOP
    echo VIDEO FORMAT CONTAINER DURATION:  
    ffprobe -v error -show_entries format=duration \
     -of default=noprint_wrappers=1:nokey=1 output_720.mp4
    echo VIDEO STREAM DURATION:
    ffprobe -v error -select_streams v:0 -show_entries stream=duration \
     -of default=noprint_wrappers=1:nokey=1 output_720.mp4
    echo DONE
    exit 1

    Here the script with my videos for test and relative folders :
    https://gofile.io/?c=WPAC0Q