Recherche avancée

Médias (91)

Autres articles (29)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

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

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

Sur d’autres sites (4074)

  • ffmpeg : is there a fast way for extracting several thumbnails from a video without parsing the video from the beginning every time ?

    18 mars, par archie

    I tried several ways for extracting sample frames from a video file with ffmpeg. I found out that the fastest way is by placing the following command in a loop :

    


    ffmpeg -ss $frame_time -i "$input_video" -frames:v 1 -vf scale=256:-1 "$Work_dir/thumb$thumb_index.jpg"


    


    (I have omitted the parts of the command that are not relevant to the question, such as drawtext, hide_banner, loglevel). The variables frame_time and thumb_index are initialized before the loop and incremented by a fixed amount at every step : +1 for thumbs_index and $duration/25 for frame_time. I read in the ffmpeg documentation (https://trac.ffmpeg.org/wiki/Seeking) that having the -ss part before the -i part is very fast because the input is parsed by keyframe. For the same reason, the loop containing the command above is also much faster than commands based on "-vf fps=$thumbs_number/$duration".

    


    In fact, the code works pretty well. However, I can't escape a feeling of programming discomfort, because ffmpeg is called several times for each video file, and every time it has to parse the file from the beginning. I mean, if I had a function doing the same as the command above — it would parse a video from the beginning to search for a frame at a certain time — calling it n times to extract a regular sequence of n frames would be bad programming. I should change the function to parse the video file once and get all the frames I need in a single pass.

    


    My question is : is there a fast way for having ffmpeg parse a video file a single time, searching by keyframes and extracting a given number of frames at a given distance from one another ? I am ready to take No for an answer, but one who is deeper into ffmpeg than I am might know a way. Thanks

    


  • ffmpeg - connection drop every few minuts- connection timeout

    9 novembre 2018, par Gloytos htyqo

    im runing ffmpeg to restream hls/m3u8 from another website(its my website).

    i have more visitors on a period of the day and then ffmpeg stops every 3-6 minutes idont know why it stops, as i saw here in logs error is : Connection timeout , what can i do in this case

    /root/bin/ffmpeg -i http://example.com/1.m3u8 -c copy -bufsize 600k
    -hls_flags delete_segments -y /var/www/html/1.m3u8

    [hls,applehttp @ 0x365f740] Opening 'http://example.com/13152.ts' for reading
    [hls,applehttp @ 0x365f740] Failed to open segment of playlist 0
    [hls,applehttp @ 0x365f740] Opening 'http://example.com/13153.ts' for reading
    frame= 6500 fps= 20 q=-1.0 size=N/A time=00:05:06.29 bitrate=N/A speed=0.962x   [hls @ 0x3689540] Opening '/var/www/html/tv1/test46.ts' for writing
    [hls @ 0x3689540] Opening '/var/www/html/tv1/test.m3u8.tmp' for writing
    [hls,applehttp @ 0x365f740] Opening 'http://example.com/13154.ts' for reading
    frame= 6750 fps= 21 q=-1.0 size=N/A time=00:05:21.17 bitrate=N/A speed=0.979x   [hls @ 0x3689540] Opening '/var/www/html/tv1/test47.ts' for writing
    [hls @ 0x3689540] Opening '/var/www/html/tv1/test.m3u8.tmp' for writing
    [hls,applehttp @ 0x365f740] Opening 'http://example.com/13155.ts' for reading
    [hls @ 0x3689540] Opening '/var/www/html/tv1/test48.ts' for writingeed=0.97x
    [hls @ 0x3689540] Opening '/var/www/html/tv1/test.m3u8.tmp' for writing
    [hls,applehttp @ 0x365f740] Opening 'http://example.com/13156.ts' for reading
    frame= 7089 fps= 21 q=-1.0 size=N/A time=00:05:34.74 bitrate=N/A speed=0.986x   [hls @ 0x3689540] Opening '/var/www/html/tv1/test49.ts' for writing
    [hls @ 0x3689540] Opening '/var/www/html/tv1/test.m3u8.tmp' for writing
    [hls,applehttp @ 0x365f740] Failed to reload playlist 0trate=N/A speed=   1x
    frame= 7339 fps= 21 q=-1.0 size=N/A time=00:05:44.73 bitrate=N/A speed=0.985x   [hls,applehttp @ 0x365f740] Opening 'http://example.com/13157.ts' for reading
    http://example.com/1.m3u8: Connection timed out
    [hls @ 0x3689540] Opening '/var/www/html/tv1/test.m3u8.tmp' for writing
    frame= 7339 fps= 21 q=-1.0 Lsize=N/A time=00:05:44.73 bitrate=N/A speed=0.964x  
    video:7793kB audio:4586kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    [root@T2 www]#

    /root/bin/ffmpeg -v trace -re -err_detect aggressive -user_agent server
    -i http://example.com/1.m3u8 -c copy -bufsize 1600k -hls_flags delete_segments -y /var/www/html/1.m3u8

     Last message repeated 2 times
    [mpegts @ 0x3715660] pid=101 pes_code=0x1c0
    [mpegts @ 0x3770560] nal 9
       Last message repeated 2 times
    [mpegts @ 0x3715660] pid=100 pes_code=0x1e0:02:20.88 bitrate=N/A speed=   1x
    [mpegts @ 0x3770560] nal 9
    [mpegts @ 0x3715660] pid=100 pes_code=0x1e0
       Last message repeated 2 times
    [mpegts @ 0x3715660] pid=101 pes_code=0x1c0
    [mpegts @ 0x3770560] nal 9
       Last message repeated 2 times
    [mpegts @ 0x3715660] pid=100 pes_code=0x1e0
    [mpegts @ 0x3770560] nal 9
    [mpegts @ 0x3715660] pid=100 pes_code=0x1e0
       Last message repeated 1 times
    [mpegts @ 0x3715660] pid=101 pes_code=0x1c0
    [mpegts @ 0x3770560] nal 9
       Last message repeated 1 times
    [AVIOContext @ 0x3773300] Statistics: 806144 bytes read, 0 seeks
    [hls,applehttp @ 0x370e760] Opening 'http://example.com/1.m3u8' for reading
    [hls,applehttp @ 0x370e760] Failed to reload playlist 0
    [mpegts @ 0x3770560] nal 9
       Last message repeated 1 times
    [hls,applehttp @ 0x370e760] Opening 'http://example.com/1.m3u8' for reading
    [hls,applehttp @ 0x370e760] Failed to reload playlist 0
    No more output streams to write to, finishing.
    [AVIOContext @ 0x37752e0] Statistics: 0 seeks, 4 writeouts
    [hls muxer @ 0x3738fe0] deleting old segment test6.ts
    [hls @ 0x37755c0] Opening '/var/www/html/1.m3u8.tmp' for writing
    [file @ 0x3773480] Setting default whitelist 'file,crypto'
    [hls muxer @ 0x3738fe0] EXT-X-MEDIA-SEQUENCE:16
    [AVIOContext @ 0x3773300] Statistics: 0 seeks, 1 writeouts
    frame= 3532 fps= 23 q=-1.0 Lsize=N/A time=00:02:21.24 bitrate=N/A speed=0.932x
    video:5169kB audio:2207kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    Input file #0 (http://example.com/1.m3u8):
     Input stream #0:0 (video): 3532 packets read (5293095 bytes);
     Input stream #0:1 (audio): 5886 packets read (2260224 bytes);
     Total: 9418 packets (7553319 bytes) demuxed
    Output file #0 (/var/www/html/1.m3u8):
     Output stream #0:0 (video): 3532 packets muxed (5293095 bytes);
     Output stream #0:1 (audio): 5886 packets muxed (2260224 bytes);
     Total: 9418 packets (7553319 bytes) muxed
    0 frames successfully decoded, 0 decoding errors
    [AVIOContext @ 0x371a900] Statistics: 236 bytes read, 0 seeks
    [root@T2 www]#
  • audio is out of sync after concat 2 files

    1er juin 2019, par S.T

    i want to show a video, that has 2 movies side by side. each movie is a result of one movie that concat 2 times. the problem is that the audio in the right side is out of sync.

    i have 3 commands :
    first command concat one movie 2 times

    ffmpeg -i 1.mp4 -i 1.mp4 -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[concatv][concata]" -map "[concatv]" -map "[concata]" Concat1.mp4

    second command concat the second movie 2 times

    ffmpeg -i 2.mp4 -i 2.mp4 -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[concatv][concata]" -map "[concatv]" -map "[concata]" Concat2.mp4

    at this point the audio is always synced.
    the third command takes the 2 results and merge it to one movie side by side with a logo :

    ffmpeg -i Concat1.mp4 -i Concat2.mp4 -i logo.png -filter_complex "[0:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=black[a];[1:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=black[b];nullsrc=size=640x480[base];[a]setpts=PTS-STARTPTS, scale=320x480[left];[b]setpts=PTS-STARTPTS, scale=320x480[right];[base][left]overlay=shortest=1[tmp1];[tmp1][right] overlay=320:0[video];[0:a]apad [apa];[apa][1:a]amerge=inputs=2,pan=stereo|FLcode>

    the problem is that in the output file the audio of the right movie is out of sync in its second time (the second concat). it always the right movie that is out of sync, even when i switch them.

    can anyone help ?
    Thanks.

    ==============EDIT===================

    the problem of the sync has solved by adding apad also to the second file, but after that the command never stops... how can i tell the command to stop when both movies ended if i have apad for both movies ?
    this is the new command that never stops :

    ffmpeg -i 1.mp4 -i 2.mp4 -i logo.png -filter_complex "[0:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=black[a];[1:v]pad=width=iw+20:height=ih+20:x=10:y=10:color=black[b];nullsrc=size=640x480[base];[a]scale=320x480[left];[b]scale=320x480[right];[base][left]overlay=shortest=1[tmp1];[tmp1][right] overlay=320:0[video];[1:a]apad [apa];[0:a]apad[apa1];[apa][apa1]amix=inputs=2:duration=longest[audio];[2:v]scale=120:44 [ovrl];[video][ovrl]overlay=15:25[videoandlogo]" -map "[videoandlogo]" -map "[audio]" output.mp4