Recherche avancée

Médias (16)

Mot : - Tags -/mp3

Autres articles (90)

  • Mediabox : ouvrir les images dans l’espace maximal pour l’utilisateur

    8 février 2011, par

    La visualisation des images est restreinte par la largeur accordée par le design du site (dépendant du thème utilisé). Elles sont donc visibles sous un format réduit. Afin de profiter de l’ensemble de la place disponible sur l’écran de l’utilisateur, il est possible d’ajouter une fonctionnalité d’affichage de l’image dans une boite multimedia apparaissant au dessus du reste du contenu.
    Pour ce faire il est nécessaire d’installer le plugin "Mediabox".
    Configuration de la boite multimédia
    Dès (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

Sur d’autres sites (8215)

  • Resuming ffmpeg hls trancoding from an existing segment

    2 juillet 2024, par Fdebijl

    I'm setting up a service to transcode input videos, generally MP4, for HLS with MPEG-TS as the container format. This currently works fine when starting from scratch, but I would like the transcode to be resumable in case the service crashes while working on a longer video.

    


    I'm running into two issues with resuming the transcoding process :

    


      

    • ffmpeg generates too many segments : if the processing is halted at, say, 10 segments for a video that should be 20 segments long and processing is resumed later, the manifest contains 10 + 20 segments, where the final 10 segments don't actually play back properly
    • 


    • Adjacent to this, running the command again when the video is fully transcoded results in the playlist being appended with the entire video once more, with the numbers above that would result in 20 additional segments being added to the playlist every time the conversion is ran. In other words, ffmpeg doesn't realize the transcoding is already complete
    • 


    


    The desired result here is that running the ffmpeg command again simply continues the transcode after the last completed segment and appends these segments to the m3u8 playlist. If all the segments are already present ffmpeg should not output or modify anything. I've tried to coax ffmpeg into this behaviour, but no combination of -start_number, -ss and append_list gets me there.

    


    Here's my current command that is executed when a transcode should be resumed (I've ommited some filters for brevity) :

    


    ffmpeg -i input -map 0:v -map 0:a -map 0:v -map 0:a -map 0:v -map 0:a \
-c:v libx264 -preset veryfast -c:a libfdk_aac \
-maxrate:v:0 1500K -b:a:0 128k \
-maxrate:v:1 3000K -b:a:1 192k \ 
-maxrate:v:2 6000K -b:a:2 256k \
-flags +cgop -g 60 -hls_time 5 -hls_list_size 0 \
-hls_flags independent_segments+temp_file+append_list \
-var_stream_map "v:0,a:0,name:480p v:1,a:1,name:720p v:2,a:2,name:1080p" \
-y -f hls -master_pl_name master.m3u8 ./%v.m3u8


    


    Here is the folder structure that ffmpeg would work in for a resumed transcode, assuming the service crashed after the first two chunks :

    


    .
├── 1080p.m3u8   
├── 1080p0.ts    
├── 1080p1.ts   
├── 480p.m3u8    
├── 480p0.ts     
├── 480p1.ts     
├── 720p.m3u8    
├── 720p0.ts     
├── 720p1.ts     
├── input        
└── master.m3u8  


    


    Here is the contents of 480p.m3u8 :

    


    #EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:5.000000,
480p0.ts
#EXTINF:5.000000,
480p1.ts
#EXT-X-ENDLIST


    


    However, as explained in the prelude, running the command against this folder results in too many chunks being appended to the playlist.

    


    This is the expected 480p playlist :

    


    #EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:5.000000,
480p0.ts
#EXTINF:5.000000,
480p1.ts
#EXTINF:5.000000,
480p2.ts
#EXTINF:5.000000,
480p3.ts
#EXTINF:5.000000,
480p4.ts
#EXTINF:5.733333,
480p5.ts
#EXTINF:5.000000,
480p6.ts
#EXTINF:5.000000,
480p7.ts
#EXTINF:5.000000,
480p8.ts
#EXTINF:5.000000,
480p9.ts
#EXTINF:5.000000,
480p10.ts
#EXTINF:5.000000,
480p11.ts
#EXTINF:5.000000,
480p12.ts
#EXTINF:3.950000,
480p13.ts
#EXT-X-ENDLIST


    


    And this is the actual playlist :

    


    #EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:5.000000,
480p0.ts
#EXTINF:5.000000,
480p1.ts
#EXT-X-DISCONTINUITY
#EXTINF:5.000000,
480p2.ts
#EXTINF:5.000000,
480p3.ts
#EXTINF:5.000000,
480p4.ts
#EXTINF:5.000000,
480p5.ts
#EXTINF:5.000000,
480p6.ts
#EXTINF:5.733333,
480p7.ts
#EXTINF:5.000000,
480p8.ts
#EXTINF:5.000000,
480p9.ts
#EXTINF:5.000000,
480p10.ts
#EXTINF:5.000000,
480p11.ts
#EXTINF:5.000000,
480p12.ts
#EXTINF:5.000000,
480p13.ts
#EXTINF:5.000000,
480p14.ts
#EXTINF:3.950000,
480p15.ts
#EXT-X-ENDLIST


    


    I've already surmised the #EXT-X-DISCONTINUITY tag can't be disabled, which is fine, as I can remove that with post-processing steps. The two extra segments are problematic however, as they break the video at the end of its actual runtime.

    


    To bring this to a point : is there a way to get ffmpeg to resume transcoding from the last segment, such that it does not append the entire video to the last transcoding attempt ?

    


  • my ffmpeg livestream keeps crashing : How do I troubleshoot ?

    12 février 2024, par n79qk272x57w46w9

    I can't find the reason on why it is crashing, all I have is a list of mp3 files which are encoded to AAC on the fly.

    


    stream.sh

    


    #!/bin/bash

ffmpeg \
-stream_loop -1 -re \
-i video.mp4 \
-safe 0 \
-f concat \
-i playlist.txt \
-c:v libx264 -preset slower -b:v 3500k -maxrate 3500k -bufsize 7000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 320k -ac 2 -ar 44100 -f flv \
rtmps://---------------/s/----key----:----key----


    


    This is what journalctl collected :

    


    Feb 12 18:07:57 main bash[3236855]: [47.9K blob data]
Feb 12 18:11:38 main bash[3236855]: [48.0K blob data]
Feb 12 18:15:19 main bash[3236855]: [48.0K blob data]
Feb 12 18:18:59 main bash[3236855]: [48.0K blob data]
Feb 12 18:22:41 main bash[3236855]: [48.0K blob data]
Feb 12 18:26:21 main bash[3236855]: [48.0K blob data]
Feb 12 18:30:02 main bash[3236855]: [48.0K blob data]
Feb 12 18:33:42 main bash[3236855]: [48.0K blob data]
Feb 12 18:37:23 main bash[3236855]: [48.0K blob data]
Feb 12 18:41:03 main bash[3236855]: [48.0K blob data]
Feb 12 18:44:44 main bash[3236855]: [48.0K blob data]
Feb 12 18:48:25 main bash[3236855]: [48.0K blob data]
Feb 12 18:50:07 main bash[3236855]: [22.3K blob data]
Feb 12 18:50:07 main bash[3236855]: av_interleaved_write_frame(): Input/output error
Feb 12 18:50:09 main bash[3236855]:     Last message repeated 1 times
Feb 12 18:50:09 main bash[3236855]: [flv @ 0x5642d6c08c00] Failed to update header with correct duration.
Feb 12 18:50:09 main bash[3236855]: [flv @ 0x5642d6c08c00] Failed to update header with correct filesize.
Feb 12 18:50:09 main bash[3236855]: Error writing trailer of rtmps://------------/s/key:key: Input/output error
Feb 12 18:50:09 main bash[3236855]: frame=1215777 fps= 30 q=14.0 Lsize=18376958kB time=11:16:04.14 bitrate=3711.3kbits/s dup=0 drop=1 speed=   1x
Feb 12 18:50:09 main bash[3236855]: video:16828839kB audio:1495386kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.287779%
Feb 12 18:50:09 main bash[3236855]: [tls @ 0x5642d6bbcf40] The specified session has been invalidated for some reason.
Feb 12 18:50:09 main bash[3236855]:     Last message repeated 1 times
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] frame I:24338 Avg QP: 3.06  size: 52975
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] frame P:393923 Avg QP: 6.45  size: 24751
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] frame B:797516 Avg QP: 9.68  size:  7767
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] consecutive B-frames:  6.8% 12.2% 15.4% 65.7%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] mb I  I16..4: 47.0%  5.2% 47.9%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] mb P  I16..4:  0.8%  0.5%  4.3%  P16..4: 18.2% 13.6% 11.8%  4.1%  2.3%    skip:44.2%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] mb B  I16..4:  0.2%  0.1%  0.7%  B16..8: 21.7% 14.2%  6.4%  direct: 7.9%  skip:48.8%  L0:35.3% L1:35.8% BI:28.9%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] 8x8 transform intra:6.6% inter:16.5%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] direct mvs  spatial:99.7% temporal:0.3%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] coded y,uvDC,uvAC intra: 68.9% 62.6% 52.6% inter: 36.3% 21.5% 11.4%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] i16 v,h,dc,p: 70% 14% 13%  3%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 21% 19%  5%  5%  5%  6%  8% 10%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 23% 18%  5%  6%  6%  6%  6%  8%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] i8c dc,h,v,p: 59% 24% 12%  5%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] Weighted P-Frames: Y:2.0% UV:0.5%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] ref P L0: 69.7% 13.7%  6.8%  3.4%  2.0%  1.8%  1.3%  1.2%  0.2%  0.0%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] ref B L0: 88.7%  7.1%  2.0%  0.9%  0.7%  0.4%  0.3%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] ref B L1: 97.2%  2.8%
Feb 12 18:50:09 main bash[3236855]: [libx264 @ 0x5642d6be6300] kb/s:3398.63
Feb 12 18:50:09 main bash[3236855]: [aac @ 0x5642d6bbdd40] Qavg: 14231.606
Feb 12 18:50:09 main bash[3236855]: Conversion failed!
Feb 12 18:50:09 main systemd[1]: stream.service: Main process exited, code=exited, status=1/FAILURE
Feb 12 18:50:09 main systemd[1]: stream.service: Failed with result 'exit-code'.


    


    From this log it is hard to tell at which point and which file it started to have problems converting.

    


  • PHP large video upload converting to mp3 by ffmpeg

    27 mai 2017, par SuperBerry

    I am working on a project on Linux VPS (Apache + PHP5, 4G RAM / 2 CPU Cores) which allows users to upload videos (200M max) and convert to MP3 audio files by FFMPEG. I have few questions about the concurrency and the processing because I am a newbie on PHP :

    1. If there are 10 visitors uploading (1 visitor uploads one 200M MP4 file), will it cost 2,000M memory of the server ? Will the chunk upload method could solve this memeory issue while more visitors uploading videos at the same time ?

    2. I am going to use Redis to manage the ffmpeg processing queue, and set the crontab. Should I use the shell_exec() to call the ffmpeg to process the conversion at background, then convert the uploaded videos one by one ?

    The uploading and conversion is the most cost for the server I think... Maybe my idea is extremely crazy...I am new to this type of service.. I didn’t make online projects before, just desktop apps...

    Thanks a lot for your help..