Recherche avancée

Médias (91)

Autres articles (49)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

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

Sur d’autres sites (6719)

  • FFMPEG in thread error : Thread was being aborted

    21 juillet 2018, par swabygw

    I’m using FFMPEG to convert video files from one file type to another. I do it via an ASP.NET web interface where a user can upload their file and the conversion happens in a .NET "thread", like this :

    trd = New Thread(Sub(sender) TestSub(folder,interv,objCounter,fname,fversource,fverdest,fext,fhost))
    trd.Priority = ThreadPriority.Lowest
    trd.Start

    While the conversion is happening, I’m logging the progress of the conversion by using the FFMPEG "-progress" argument.

    If I don’t use a thread, I get a complete log that looks like the output below. But when I run it in a thread, the conversion happens successfully still, but I get this error message from .NET : "Thread was being aborted." right after line #46...regardless of the file type, file size, etc., it always errors after line #46. I need to capture the rest of the output from the execution in the thread (just like when it was run outside of the thread). Can anyone help ?

    P.S., I have tried extending the server timeout, like this (it didn’t help) : httpRuntime executionTimeout = "600", in the web.config file.

    P.P.S, found something interesting. I’m using a StreamReader to capture the output, and I log each line of the StreamReader to an output file, like this :

    Dim ffReader As StreamReader
    prcFFMPEG.Start
    ffReader = prcFFMPEG.StandardError

    While Not ffReader.EndOfStream
       strFFOUT = "Test:" & ffReader.ReadLine
       LogConversion(fhost,"strFFOUT(ffReader.ReadLine): " & (strFFOUT).ToString)
    End While

    Here’s the odd part : In the While/EndWhile loop, if I print out just "Test" instead of ffReader.ReadLine, it runs, I get a lot more lines, and the thread aborts but I see FFMPEG still running in Task Manager. If I leave it running in Task Manager and rerun the code with ffReader.ReadLine, it will print out everything with no errors/aborts. But, if I end the background task in Task Manager, I get the same problem and error again.

    strFFOUT(0): ffmpeg version N-67331-g547fce9 Copyright (c) 2000-2014 the FFmpeg developers
    strFFOUT(1): built on Nov 1 2014 22:01:52 with gcc 4.9.1 (GCC)
    strFFOUT(2): configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib
    strFFOUT(3): libavutil 54. 11.100 / 54. 11.100
    strFFOUT(4): libavcodec 56. 10.101 / 56. 10.101
    strFFOUT(5): libavformat 56. 12.100 / 56. 12.100
    strFFOUT(6): libavdevice 56. 2.100 / 56. 2.100
    strFFOUT(7): libavfilter 5. 2.101 / 5. 2.101
    strFFOUT(8): libswscale 3. 1.101 / 3. 1.101
    strFFOUT(9): libswresample 1. 1.100 / 1. 1.100
    strFFOUT(10): libpostproc 53. 3.100 / 53. 3.100
    strFFOUT(11): [mov,mp4,m4a,3gp,3g2,mj2 @ 02a28700] overread end of atom 'colr' by 1 bytes
    strFFOUT(12): Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\inetpub\wwwroot\site\short_sample.mp4':
    strFFOUT(13): Metadata:
    strFFOUT(14): major_brand : mp42
    strFFOUT(15): minor_version : 0
    strFFOUT(16): compatible_brands: mp42isomavc1
    strFFOUT(17): creation_time : 2010-03-20 21:29:11
    strFFOUT(18): encoder : HandBrake 0.9.4 2009112300
    strFFOUT(19): Duration: 00:00:05.57, start: 0.000000, bitrate: 551 kb/s
    strFFOUT(20): Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 560x320, 465 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
    strFFOUT(21): Metadata:
    strFFOUT(22): creation_time : 2010-03-20 21:29:11
    strFFOUT(23): encoder : JVT/AVC Coding
    strFFOUT(24): Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 83 kb/s (default)
    strFFOUT(25): Metadata:
    strFFOUT(26): creation_time : 2010-03-20 21:29:11
    strFFOUT(27): [libx264 @ 02a2e840] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
    strFFOUT(28): [libx264 @ 02a2e840] profile High, level 2.1
    strFFOUT(29): [libx264 @ 02a2e840] 264 - core 142 r2479 dd79a61 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=cqp mbtree=0 qp=23 ip_ratio=1.40 pb_ratio=1.30 aq=0
    strFFOUT(30): Output #0, mp4, to 'C:\inetpub\wwwroot\site\short_sample3.mp4':
    strFFOUT(31): Metadata:
    strFFOUT(32): major_brand : mp42
    strFFOUT(33): minor_version : 0
    strFFOUT(34): compatible_brands: mp42isomavc1
    strFFOUT(35): encoder : Lavf56.12.100
    strFFOUT(36): Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 480x320, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    strFFOUT(37): Metadata:
    strFFOUT(38): creation_time : 2010-03-20 21:29:11
    strFFOUT(39): encoder : Lavc56.10.101 libx264
    strFFOUT(40): Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s (default)
    strFFOUT(41): Metadata:
    strFFOUT(42): creation_time : 2010-03-20 21:29:11
    strFFOUT(43): encoder : Lavc56.10.101 libvo_aacenc
    strFFOUT(44): Stream mapping:
    strFFOUT(45): Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    strFFOUT(46): Stream #0:1 -> #0:1 (aac (native) -> aac (libvo_aacenc))
    strFFOUT(47): frame= 96 fps=0.0 q=23.0 size= 146kB time=00:00:03.37 bitrate= 355.3kbits/s
    strFFOUT(48): frame= 166 fps=0.0 q=-1.0 Lsize= 274kB time=00:00:05.58 bitrate= 401.7kbits/s
    strFFOUT(49):
    strFFOUT(50): video:179kB audio:87kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.677233%
    strFFOUT(51): [libx264 @ 02a2e840] frame I:1 Avg QP:20.00 size: 19154
    strFFOUT(52): [libx264 @ 02a2e840] frame P:48 Avg QP:23.00 size: 1976
    strFFOUT(53): [libx264 @ 02a2e840] frame B:117 Avg QP:24.63 size: 588
    strFFOUT(54): [libx264 @ 02a2e840] consecutive B-frames: 3.6% 0.0% 21.7% 74.7%
    strFFOUT(55): [libx264 @ 02a2e840] mb I I16..4: 46.2% 21.2% 32.7%
    strFFOUT(56): [libx264 @ 02a2e840] mb P I16..4: 1.1% 0.3% 0.2% P16..4: 29.1% 7.5% 7.3% 0.0% 0.0% skip:54.3%
    strFFOUT(57): [libx264 @ 02a2e840] mb B I16..4: 0.0% 0.0% 0.1% B16..8: 17.5% 3.6% 1.2% direct: 1.1% skip:76.4% L0:39.0% L1:49.6% BI:11.4%
    strFFOUT(58): [libx264 @ 02a2e840] 8x8 transform intra:21.9% inter:51.2%
    strFFOUT(59): [libx264 @ 02a2e840] coded y,uvDC,uvAC intra: 40.4% 70.7% 40.6% inter: 5.8% 10.3% 3.0%
    strFFOUT(60): [libx264 @ 02a2e840] i16 v,h,dc,p: 0% 25% 1% 74%
    strFFOUT(61): [libx264 @ 02a2e840] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 9% 36% 14% 5% 7% 4% 13% 4% 8%
    strFFOUT(62): [libx264 @ 02a2e840] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 25% 12% 4% 8% 8% 13% 6% 8%
    strFFOUT(63): [libx264 @ 02a2e840] i8c dc,h,v,p: 49% 35% 10% 6%
    strFFOUT(64): [libx264 @ 02a2e840] Weighted P-Frames: Y:0.0% UV:0.0%
    strFFOUT(65): [libx264 @ 02a2e840] ref P L0: 65.7% 5.6% 18.5% 10.3%
    strFFOUT(66): [libx264 @ 02a2e840] ref B L0: 79.0% 14.9% 6.0%
    strFFOUT(67): [libx264 @ 02a2e840] ref B L1: 91.1% 8.9%
    strFFOUT(68): [libx264 @ 02a2e840] kb/s:264.22
  • Revision 36454 : uniformiser les inputs du formulaire de login

    19 mars 2010, par brunobergot@… — Log

    uniformiser les inputs du formulaire de login

  • Precise method of segmenting & transcoding video+audio (via ffmpeg), into an on-demand HLS stream ?

    17 novembre 2019, par Felix

    recently I’ve been messing around with FFMPEG and streams through Nodejs. My ultimate goal is to serve a transcoded video stream - from any input filetype - via HTTP, generated in real-time as it’s needed in segments.

    I’m currently attempting to handle this using HLS. I pre-generate a dummy m3u8 manifest using the known duration of the input video. It contains a bunch of URLs that point to individual constant-duration segments. Then, once the client player starts requesting the individual URLs, I use the requested path to determine which time range of video the client needs. Then I transcode the video and stream that segment back to them.

    Now for the problem : This approach mostly works, but has a small audio bug. Currently, with most test input files, my code produces a video that - while playable - seems to have a very small (< .25 second) audio skip at the start of each segment.

    I think this may be an issue with splitting using time in ffmpeg, where possibly the audio stream cannot be accurately sliced at the exact frame the video is. So far, I’ve been unable to figure out a solution to this problem.

    If anybody has any direction they can steer me - or even a prexisting library/server that solves this use-case - I appreciate the guidance. My knowledge of video encoding is fairly limited.

    I’ll include an example of my relevant current code below, so others can see where I’m stuck. You should be able to run this as a Nodejs Express server, then point any HLS player at localhost:8080/master to load the manifest and begin playback. See the transcode.get('/segment/:seg.ts' line at the end, for the relevant transcoding bit.

    'use strict';
    const express = require('express');
    const ffmpeg = require('fluent-ffmpeg');
    let PORT = 8080;
    let HOST = 'localhost';
    const transcode = express();


    /*
    * This file demonstrates an Express-based server, which transcodes &amp; streams a video file.
    * All transcoding is handled in memory, in chunks, as needed by the player.
    *
    * It works by generating a fake manifest file for an HLS stream, at the endpoint "/m3u8".
    * This manifest contains links to each "segment" video clip, which browser-side HLS players will load as-needed.
    *
    * The "/segment/:seg.ts" endpoint is the request destination for each clip,
    * and uses FFMpeg to generate each segment on-the-fly, based off which segment is requested.
    */


    const pathToMovie = 'C:\\input-file.mp4';  // The input file to stream as HLS.
    const segmentDur = 5; //  Controls the duration (in seconds) that the file will be chopped into.


    const getMetadata = async(file) => {
       return new Promise( resolve => {
           ffmpeg.ffprobe(file, function(err, metadata) {
               console.log(metadata);
               resolve(metadata);
           });
       });
    };



    // Generate a "master" m3u8 file, which the player should point to:
    transcode.get('/master', async(req, res) => {
       res.set({"Content-Disposition":"attachment; filename=\"m3u8.m3u8\""});
       res.send(`#EXTM3U
    #EXT-X-STREAM-INF:BANDWIDTH=150000
    /m3u8?num=1
    #EXT-X-STREAM-INF:BANDWIDTH=240000
    /m3u8?num=2`)
    });

    // Generate an m3u8 file to emulate a premade video manifest. Guesses segments based off duration.
    transcode.get('/m3u8', async(req, res) => {
       let met = await getMetadata(pathToMovie);
       let duration = met.format.duration;

       let out = '#EXTM3U\n' +
           '#EXT-X-VERSION:3\n' +
           `#EXT-X-TARGETDURATION:${segmentDur}\n` +
           '#EXT-X-MEDIA-SEQUENCE:0\n' +
           '#EXT-X-PLAYLIST-TYPE:VOD\n';

       let splits = Math.max(duration / segmentDur);
       for(let i=0; i&lt; splits; i++){
           out += `#EXTINF:${segmentDur},\n/segment/${i}.ts\n`;
       }
       out+='#EXT-X-ENDLIST\n';

       res.set({"Content-Disposition":"attachment; filename=\"m3u8.m3u8\""});
       res.send(out);
    });

    // Transcode the input video file into segments, using the given segment number as time offset:
    transcode.get('/segment/:seg.ts', async(req, res) => {
       const segment = req.params.seg;
       const time = segment * segmentDur;

       let proc = new ffmpeg({source: pathToMovie})
           .seekInput(time)
           .duration(segmentDur)
           .outputOptions('-preset faster')
           .outputOptions('-g 50')
           .outputOptions('-profile:v main')
           .withAudioCodec('aac')
           .outputOptions('-ar 48000')
           .withAudioBitrate('155k')
           .withVideoBitrate('1000k')
           .outputOptions('-c:v h264')
           .outputOptions(`-output_ts_offset ${time}`)
           .format('mpegts')
           .on('error', function(err, st, ste) {
               console.log('an error happened:', err, st, ste);
           }).on('progress', function(progress) {
               console.log(progress);
           })
           .pipe(res, {end: true});
    });

    transcode.listen(PORT, HOST);
    console.log(`Running on http://${HOST}:${PORT}`);