Recherche avancée

Médias (91)

Autres articles (33)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (6136)

  • AVPlayer currentTime not match with the displayed frame after many seeking. (HLS Stream)

    26 août 2022, par D.Bence

    I have a m3u8 file which i want to use with HLS.
link to m3u8 file

    


    My problem is that when i seek many times, the currentTime not match with the displayed frame. I experience that, the more seeking there is more difference. (it's like a constant +offset)

    


    Our use case is very timing sensitive, we need to stop the videos at specific positions. For this we use the following code :

    


    [_player addBoundaryTimeObserverForTimes:times
      queue:dispatch_get_main_queue()
      usingBlock:^{
            weakSelf.player.rate = 0.0;
            // The time is correct here, but the displayed frame is not sync with this time
            CMTimeShow(weakSelf.player.currentTime);
      }
]   


    


    I read that AVURLAssetPreferPreciseDurationAndTimingKey can help, but the currentTime still wrong.

    


    NSDictionary<nsstring> *options = @{AVURLAssetPreferPreciseDurationAndTimingKey:@YES};&#xA;AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:url options:options];&#xA;AVPlayerItem *item = [AVPlayerItem playerItemWithAsset:urlAsset];&#xA;</nsstring>

    &#xA;

    I also read that there is a problem with the m3u8 itself. (for example wrong GOP size.)

    &#xA;

    What is the reason for the incorrect currentTime, and how can i fix this ?

    &#xA;

    ffprobe m3u8 :

    &#xA;

    ffprobe https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.m3u8&#xA;ffprobe version 5.1 Copyright (c) 2007-2022 the FFmpeg developers&#xA;  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)&#xA;  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon&#xA;  libavutil      57. 28.100 / 57. 28.100&#xA;  libavcodec     59. 37.100 / 59. 37.100&#xA;  libavformat    59. 27.100 / 59. 27.100&#xA;  libavdevice    59.  7.100 / 59.  7.100&#xA;  libavfilter     8. 44.100 /  8. 44.100&#xA;  libswscale      6.  7.100 /  6.  7.100&#xA;  libswresample   4.  7.100 /  4.  7.100&#xA;  libpostproc    56.  6.100 / 56.  6.100&#xA;[hls @ 0x152f04280] Skip (&#x27;#EXT-X-VERSION:3&#x27;)&#xA;[hls @ 0x152f04280] Skip (&#x27;#EXT-X-INDEPENDENT-SEGMENTS&#x27;)&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_6000000bitrate.m3u8&#x27; for reading&#xA;[hls @ 0x152f04280] Skip (&#x27;#EXT-X-VERSION:3&#x27;)&#xA;[https @ 0x154045000] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_15000000bitrate.m3u8&#x27; for reading&#xA;[hls @ 0x152f04280] Skip (&#x27;#EXT-X-VERSION:3&#x27;)&#xA;[https @ 0x154045000] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1520p_33000000bitrate.m3u8&#x27; for reading&#xA;[hls @ 0x152f04280] Skip (&#x27;#EXT-X-VERSION:3&#x27;)&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_6000000bitrate_00001.ts&#x27; for reading&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_6000000bitrate_00002.ts&#x27; for reading&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_15000000bitrate_00001.ts&#x27; for reading&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_15000000bitrate_00002.ts&#x27; for reading&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1520p_33000000bitrate_00001.ts&#x27; for reading&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1520p_33000000bitrate_00002.ts&#x27; for reading&#xA;Input #0, hls, from &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.m3u8&#x27;:&#xA;  Duration: 00:49:43.00, start: 2.033367, bitrate: 0 kb/s&#xA;  Program 0&#xA;    Metadata:&#xA;      variant_bitrate : 8133826&#xA;  Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn&#xA;    Metadata:&#xA;      variant_bitrate : 8133826&#xA;  Program 1&#xA;    Metadata:&#xA;      variant_bitrate : 18870392&#xA;  Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn&#xA;    Metadata:&#xA;      variant_bitrate : 18870392&#xA;  Program 2&#xA;    Metadata:&#xA;      variant_bitrate : 40776144&#xA;  Stream #0:2: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 2704x1520 [SAR 1:1 DAR 169:95], 29.97 fps, 29.97 tbr, 90k tbn&#xA;    Metadata:&#xA;      variant_bitrate : 40776144&#xA;

    &#xA;

    ffprobe original mp4 :

    &#xA;

    ffprobe https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/finalized/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.mp4&#xA;ffprobe version 5.1 Copyright (c) 2007-2022 the FFmpeg developers&#xA;  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)&#xA;  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon&#xA;  libavutil      57. 28.100 / 57. 28.100&#xA;  libavcodec     59. 37.100 / 59. 37.100&#xA;  libavformat    59. 27.100 / 59. 27.100&#xA;  libavdevice    59.  7.100 / 59.  7.100&#xA;  libavfilter     8. 44.100 /  8. 44.100&#xA;  libswscale      6.  7.100 /  6.  7.100&#xA;  libswresample   4.  7.100 /  4.  7.100&#xA;  libpostproc    56.  6.100 / 56.  6.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/finalized/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf58.76.100&#xA;  Duration: 00:49:42.81, start: 0.000000, bitrate: 36142 kb/s&#xA;  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 2486x1398, 36138 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)&#xA;    Metadata:&#xA;      handler_name    : VideoHandler&#xA;      vendor_id       : [0][0][0][0]&#xA;

    &#xA;

  • 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>&amp;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>&amp;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

  • 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 ?