Recherche avancée

Médias (9)

Mot : - Tags -/soundtrack

Autres articles (37)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (7807)

  • Spring content + MPD manifest and Dash.js player [closed]

    31 octobre 2024, par Iupa

    I'm total newbie to video content from web, however I was curious how those things work actually, and I found so far that for web pages there are already js libs which firstly customize the video html tag to support many features like resolution/subtitles/speed etc,secondly they work with specific manifest file as a src for video, it's *.mpd extension and xml format where is described how to play the chunks of video, now in order to generate such manifests I need another libs like ffmpeg that can generate not only manifests but the chunks as well in different resolutions and other tons of settings (kinda crazy ¯_(ツ)_/¯), anyway now I understood that in order to use spring content lib I need to generate all of those during the uploads of files, are there some tutorials/best practices for such ?

    


  • How to finalize LL-DASH stream MPD file using Shaka Packager [closed]

    11 août, par Arjit

    I'm using Shaka Packager with FFmpeg piping to produce LL-DASH live streams from an NGINX-RTMP input. Streaming works fine, but when the publisher stops streaming, Shaka Player continuously trying to fetch & throws 404 errors for segment files that don’t exist.

    


    For example, if the last segment is 29.m4s, the player still tries to fetch :

    


    GET http://localhost:8080/dash/stream/480p_30.m4s 404 (Not Found)
GET http://localhost:8080/dash/stream/720p_31.m4s 404 (Not Found)


    


    Even though the stream ended at segment 29.

    


    Shaka-packager :

    


    "$SHAKA_PACKAGER_BIN" \
  "in=${VIDEO_720P_FIFO},stream=video,format=mp4,init_segment=${STREAM_OUTPUT_DIR}/720p_init.mp4,segment_template=${STREAM_OUTPUT_DIR}/720p_\$Number\$.m4s,bandwidth=3000000,hls_name=720p" \
  "in=${VIDEO_480P_FIFO},stream=video,format=mp4,init_segment=${STREAM_OUTPUT_DIR}/480p_init.mp4,segment_template=${STREAM_OUTPUT_DIR}/480p_\$Number\$.m4s,bandwidth=1500000,hls_name=480p" \
  "in=${AUDIO_FIFO},stream=audio,format=mp4,init_segment=${STREAM_OUTPUT_DIR}/audio_init.mp4,segment_template=${STREAM_OUTPUT_DIR}/audio_\$Number\$.m4s,bandwidth=128000,hls_name=audio" \
  --hls_master_playlist_output "${STREAM_OUTPUT_DIR}/master.m3u8" \
  --hls_playlist_type LIVE \
  --mpd_output "${STREAM_OUTPUT_DIR}/manifest.mpd" \
  --io_block_size 65536 \
  --segment_duration 2 \
  --low_latency_dash_mode=true \
  --utc_timings "urn:mpeg:dash:utc:http-xsdate:2014=http://time.akamai.com/?iso" \
  --min_buffer_time 1 \
  --time_shift_buffer_depth 60 \
  --hls_start_time_offset -2 \
  --preserved_segments_outside_live_window 10


    


    FFMPEG :

    


    ffmpeg -y -re -i "rtmp://localhost:1935/live/${STREAM_KEY}" \
-filter_complex \
"[0:v]split=2[v720][v480]; \
[v720]scale=w=1280:h=720,setsar=1[v720out]; \
[v480]scale=w=854:h=480,setsar=1[v480out]; \
[0:a]aresample=44100[aout]" \
\
-map "[v720out]" -c:v libx264 -b:v 3000k -maxrate 3000k -bufsize 6000k -preset veryfast -tune zerolatency -g 60 -keyint_min 60 -sc_threshold 0 \
-movflags empty_moov+default_base_moof -frag_duration 2000000 -f mp4 ${VIDEO_720P_FIFO} \
-map "[v480out]" -c:v libx264 -b:v 1500k -maxrate 1500k -bufsize 3000k -preset veryfast -tune zerolatency -g 60 -keyint_min 60 -sc_threshold 0 \
-movflags empty_moov+default_base_moof -frag_duration 2000000 -f mp4 ${VIDEO_480P_FIFO} \
-map "[aout]" -c:a aac -b:a 128k \
-movflags empty_moov+default_base_moof -frag_duration 2000000 -f mp4 ${AUDIO_FIFO} \
-loglevel info -stats


    


    To finalize the stream, I have a script that :

    


      

    • Waits for segments to stop being created
    • 


    • Sends SIGINT to FFmpeg and Shaka Packager
    • 


    • Manually appends #EXT-X-ENDLIST to HLS playlists
    • 


    


    Here’s a simplified version of the finalization logic :

    


    #!/bin/bash
exec >> /output/debug.log 2>&1

STREAM_KEY="$1"

FFMPEG_PID_FILE="/output/${STREAM_KEY}_transcoder.pid"
SHAKA_PID_FILE="/output/${STREAM_KEY}_packager.pid"

VIDEO_720P_FIFO="/output/video_720p.pipe"
VIDEO_480P_FIFO="/output/video_480p.pipe"
AUDIO_FIFO="/output/audio.pipe"

HLS_PLAYLISTS_DIR="/output/${STREAM_KEY}"

LAST_COUNT=-1
STABLE_COUNT=0
MAX_STABLE=5  # 5 seconds of no new segments

while true; do
    CURRENT_COUNT=$(ls ${STREAM_OUTPUT_DIR}/*.m4s 2>/dev/null | wc -l)
    if [ "$CURRENT_COUNT" -eq "$LAST_COUNT" ]; then
        STABLE_COUNT=$((STABLE_COUNT + 1))
    else
        STABLE_COUNT=0
    fi

    if [ "$STABLE_COUNT" -ge "$MAX_STABLE" ]; then
        echo "No new segments for $MAX_STABLE seconds, safe to finalize."
        break
    fi

    LAST_COUNT=$CURRENT_COUNT
    sleep 1
done

# Stop Shaka Packager
if [ -f "$SHAKA_PID_FILE" ]; then
    SHAKA_PID=$(cat "$SHAKA_PID_FILE")
    kill -INT $SHAKA_PID
    echo "Waiting for Shaka Packager process $SHAKA_PID to finish..."
    while kill -0 $SHAKA_PID > /dev/null 2>&1; do
        sleep 1
    done
    echo "$(date): Killed Shaka Packager PID $SHAKA_PID"
    rm -f "$SHAKA_PID_FILE"
fi

# Stop FFmpeg transcoder if still running
if [ -f "$FFMPEG_PID_FILE" ]; then
    FFMPEG_PID=$(cat "$FFMPEG_PID_FILE")
    # kill -SIGINT $FFMPEG_PID
    kill -9 $FFMPEG_PID
    echo "Waiting for FFmpeg process $SHAKA_PID to finish..."
    while kill -0 $FFMPEG_PID > /dev/null 2>&1; do
        sleep 1
    done

    echo "$(date): Killed FFmpeg PID $FFMPEG_PID"
    rm -f "$FFMPEG_PID_FILE"
fi




for playlist in "$HLS_PLAYLISTS_DIR"/*.m3u8; do
    if [[ "$(basename "$playlist")" != "master.m3u8" ]]; then
        echo "#EXT-X-ENDLIST" >> "$playlist"
    fi
done

rm -f "$VIDEO_720P_FIFO" "$VIDEO_480P_FIFO" "$AUDIO_FIFO"

echo "$(date): Finalization complete for stream $STREAM_KEY."



    


    shaka-packager wait infinitely when i am sending INT/TERM.

    


    Question :

    


      

    • Why doesn't Shaka Packager finalize the LL-DASH MPD manifest when
receiving SIGINT ?
    • 


    • Is there a way to tell Shaka Packager to write the final segments and
set availabilityEndTime without switching to VOD mode ?
    • 


    • Should I be doing something manually to flush the last segments or
finalize the MPD, similar to #EXT-X-ENDLIST in HLS ?
    • 


    


    I only want to gracefully end the stream so Shaka Player doesn't try to fetch non-existent segments, without switching the stream to VOD mode.

    


  • live video streaming not playing on dash.js player using ffmpeg, nginx-rtmp in raspberry pi

    15 août 2016, par sparks

    I am trying to stream a live video from raspberry pi & pi camera module to web browser.But the video doesn’t play.I am using Nginx-rtmp and ffmpeg to process the video. On the client side i use dash js player trying to play the video but no luck.I see the warning on the terminal

    [flv @ 0x2c3b950] Failed to update header with correct duration.
    [flv @ 0x2c3b950] Failed to update header with correct filesize.

    But i am not sure if this could be the issue. Anybody knows what might be wrong ?I don’t expect a straight answer but i am sure somebody can guide me in the right direction. Thank you in advance. Here is my set up

    Nginx.conf

    events {
     worker_connections  1024;
    }


    http     {
           include       mime.types;
           default_type  application/octet-stream;


    sendfile        on;

    keepalive_timeout  65;

    server {
       listen       80;
       server_name 192.168.1.114 localhost;
       location / {
           root   /var/www;
           index  index.html index.htm;
       }


       location /dash {
           root /var/www;
           add_header Cache-Control no-cache;
       }

        location /dash.js{
           root /var/www;
         }

        location /hls {
          types {
           application/vnd.apple.mpegurl m3u8;
           video/mp2t ts;
         }

         root /var/www;
         index index.html;
         add_header Cache-Control no-cache;
       }

       location /rtmpcontrol{
           rtmp_control all;
        }

       location /rtmpstat{
           rtmp_stat all;
        }

       #error_page  404              /404.html;


              error_page   500 502 503 504  /50x.html;
       location = /50x.html {
           root   html;
       }

          }
    rtmp {
      server {
       listen 1935;

       chunk_size 4000;

       application rtmp {
           live on;
           hls on;
           dash on;
           dash_path /var/www/dash;
           hls_path /var/www/hls;
       }
     }
    }

    baseline.html

       
       
       
       

       
       

       
       

       
       <code class="echappe-js">&lt;script src='http://stackoverflow.com/feeds/tag/dash.all.js'&gt;&lt;/script&gt;
    &lt;script&gt;<br />
           function getUrlVars() {<br />
               var vars = {};<br />
               var parts = window.location.href.replace(/[?&amp;amp;]+([^=&amp;amp;]+)=([^&amp;amp;]*)/gi, function(m,key,value) {<br />
                   vars[key] = value;<br />
               });<br />
               return vars;<br />
           }<br />
    <br />
           function startVideo() {<br />
               var vars = getUrlVars(),<br />
                   url = &quot;http://192.168.1.114:80/dash/stream.mpd&quot;,<br />
                   video,<br />
                   context,<br />
                   player;<br />
    <br />
               if (vars &amp;amp;&amp;amp; vars.hasOwnProperty(&quot;url&quot;)) {<br />
                   url = vars.url;<br />
               }<br />
    <br />
               video = document.querySelector(&quot;.dash-video-player video&quot;);<br />
               context = new Dash.di.DashContext();<br />
               player = new MediaPlayer(context);<br />
    <br />
               player.startup();<br />
    <br />
               player.attachView(video);<br />
               player.setAutoPlay(false);<br />
    <br />
               player.attachSource(url);<br />
           }<br />
       &lt;/script&gt;

    &lt;body onload=&quot;startVideo()&quot;&gt;

    How i grab and push video stream

    raspivid -w 640 -h 480 -fps 25 -t 0 -b 1800000 -o - | ffmpeg -y -f h264 -i - -vcodec libx264  -f flv -rtmp_buffer 100 -rtmp_live live rtmp://localhost:1935/rtmp/stream

    When i run the above command, i see the following on the terminal

       ffmpeg version N-81256-gd3426fb Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 4.9.2 (Raspbian 4.9.2-10)
     configuration: --enable-gpl --enable-libx264 --enable-nonfree
     libavutil      55. 28.100 / 55. 28.100
     libavcodec     57. 51.100 / 57. 51.100
     libavformat    57. 44.100 / 57. 44.100
     libavdevice    57.  0.102 / 57.  0.102
     libavfilter     6. 49.100 /  6. 49.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  1.100 /  2.  1.100
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, h264, from 'pipe:':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: h264 (High), yuv420p, 640x480, 25 fps, 25 tbr, 1200k tbn, 50 tbc
    [tcp @ 0x2c3c850] Connection to tcp://localhost:1935 failed (Connection refused), trying next address
    [libx264 @ 0x2c50d80] using cpu capabilities: ARMv6 NEON
    [libx264 @ 0x2c50d80] profile High, level 3.0
    [libx264 @ 0x2c50d80] 264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [flv @ 0x2c3b950] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Output #0, flv, to 'rtmp://localhost:1935/rtmp/stream':
     Metadata:
       encoder         : Lavf57.44.100
       Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 640x480, q=-1--1, 25 fps, 1k tbn, 25 tbc
       Metadata:
         encoder         : Lavc57.51.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    ^Cmmal: Aborting program.0 size=     930kB time=00:00:45.44 bitrate= 167.7kbits/s speed=1.03x    

    [flv @ 0x2c3b950] Failed to update header with correct duration.
    [flv @ 0x2c3b950] Failed to update header with correct filesize.
    frame= 1197 fps= 26 q=-1.0 Lsize=     976kB time=00:00:47.76 bitrate= 167.5kbits/s speed=1.04x    
    video:953kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.484349%
    [libx264 @ 0x2c50d80] frame I:5     Avg QP:18.91  size:  3600
    [libx264 @ 0x2c50d80] frame P:299   Avg QP:21.38  size:  1486
    [libx264 @ 0x2c50d80] frame B:893   Avg QP:20.62  size:   574
    [libx264 @ 0x2c50d80] consecutive B-frames:  0.4%  0.0%  1.0% 98.6%
    [libx264 @ 0x2c50d80] mb I  I16..4: 10.1% 87.1%  2.8%
    [libx264 @ 0x2c50d80] mb P  I16..4:  3.8%  7.4%  0.0%  P16..4: 34.2%  2.1%  1.5%  0.0%  0.0%    skip:51.0%
    [libx264 @ 0x2c50d80] mb B  I16..4:  0.2%  0.3%  0.0%  B16..8: 20.1%  0.4%  0.0%  direct: 3.8%  skip:75.1%  L0:48.6% L1:50.9% BI: 0.6%
    [libx264 @ 0x2c50d80] 8x8 transform intra:68.1% inter:97.0%
    [libx264 @ 0x2c50d80] coded y,uvDC,uvAC intra: 10.1% 27.5% 1.8% inter: 2.0% 12.9% 0.1%
    [libx264 @ 0x2c50d80] i16 v,h,dc,p: 18% 20%  9% 53%
    [libx264 @ 0x2c50d80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 11% 58%  2%  2%  1%  2%  1%  1%
    [libx264 @ 0x2c50d80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 26% 30%  3%  4%  4%  6%  2%  2%
    [libx264 @ 0x2c50d80] i8c dc,h,v,p: 66% 18% 15%  1%
    [libx264 @ 0x2c50d80] Weighted P-Frames: Y:1.7% UV:1.3%
    [libx264 @ 0x2c50d80] ref P L0: 58.2%  2.2% 25.5% 14.1%  0.1%
    [libx264 @ 0x2c50d80] ref B L0: 81.7% 13.3%  5.0%
    [libx264 @ 0x2c50d80] ref B L1: 93.6%  6.4%
    [libx264 @ 0x2c50d80] kb/s:162.87
    Exiting normally, received signal 2.

    On my var/www/dash directory

    stream-0.m4a  stream-19200.m4a  stream-29200.m4a  
    stream-9600.m4a    stream-init.m4a  stream.mpd      stream-raw.m4v
    stream-0.m4v  stream-19200.m4v  stream-29200.m4v  stream-9600.m4v    stream-init.m4v  stream-raw.m4a