Recherche avancée

Médias (91)

Autres articles (106)

  • Soumettre bugs et patchs

    10 avril 2011

    Un logiciel n’est malheureusement jamais parfait...
    Si vous pensez avoir mis la main sur un bug, reportez le dans notre système de tickets en prenant bien soin de nous remonter certaines informations pertinentes : le type de navigateur et sa version exacte avec lequel vous avez l’anomalie ; une explication la plus précise possible du problème rencontré ; si possibles les étapes pour reproduire le problème ; un lien vers le site / la page en question ;
    Si vous pensez avoir résolu vous même le bug (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

Sur d’autres sites (8971)

  • Transcode webcam blob to RTMP using ffmpeg.wasm

    29 novembre 2023, par hassan moradnezhad

    I'm trying transcode webcam blob data to a rtmp server from browser by using ffmpeg.wasm .
    
first, i create a MediaStream.

    


            const stream = await navigator.mediaDevices.getUserMedia({
            video: true,
        });


    


    then, i create a MediaRecorder.

    


            const recorder = new MediaRecorder(stream, {mimeType: "video/webm; codecs:vp9"});
        recorder.ondataavailable = handleDataAvailable;
        recorder.start(0)


    


    when data is available, i call a function called handleDataAvailable.
    
here is the function.

    


        const handleDataAvailable = (event: BlobEvent) => {
        console.log("data-available");
        if (event.data.size > 0) {
            recordedChunksRef.current.push(event.data);
            transcode(event.data)
        }
    };


    


    in above code, i use another function which called transcode it's goal is going to send data to rtmp server using use ffmpeg.wasm.
    
here it is.

    


    const transcode = async (inputVideo: Blob | undefined) => {
        const ffmpeg = ffmpegRef.current;
        const fetchFileOutput = await fetchFile(inputVideo)
        ffmpeg?.writeFile('input.webm', fetchFileOutput)

        const data = await ffmpeg?.readFile('input.webm');
        if (videoRef.current) {
            videoRef.current.src =
                URL.createObjectURL(new Blob([(data as any)?.buffer], {type: 'video/webm'}));
        }

        // execute by node-media-server config 1
        await ffmpeg?.exec(['-re', '-i', 'input.webm', '-c', 'copy', '-f', 'flv', "rtmp://localhost:1935/live/ttt"])

        // execute by node-media-server config 2
        // await ffmpeg?.exec(['-re', '-i', 'input.webm', '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency', '-c:a', 'aac', '-ar', '44100', '-f', 'flv', 'rtmp://localhost:1935/live/ttt']);

        // execute by stack-over-flow config 1
        // await ffmpeg?.exec(['-re', '-i', 'input.webm', '-c:v', 'h264', '-c:a', 'aac', '-f', 'flv', "rtmp://localhost:1935/live/ttt"]);

        // execute by stack-over-flow config 2
        // await ffmpeg?.exec(['-i', 'input.webm', '-c:v', 'libx264', '-flags:v', '+global_header', '-c:a', 'aac', '-ac', '2', '-f', 'flv', "rtmp://localhost:1935/live/ttt"]);

        // execute by stack-over-flow config 3
        // await ffmpeg?.exec(['-i', 'input.webm', '-acodec', 'aac', '-ac', '2', '-strict', 'experimental', '-ab', '160k', '-vcodec', 'libx264', '-preset', 'slow', '-profile:v', 'baseline', '-level', '30', '-maxrate', '10000000', '-bufsize', '10000000', '-b', '1000k', '-f', 'flv', 'rtmp://localhost:1935/live/ttt']);

    }


    


    after running app and start streaming, console logs are as below.

    


    ffmpeg >>>  ffmpeg version 5.1.3 Copyright (c) 2000-2022 the FFmpeg developers index.tsx:81:20
ffmpeg >>>    built with emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.40 (5c27e79dd0a9c4e27ef2326841698cdd4f6b5784) index.tsx:81:20
ffmpeg >>>    configuration: --target-os=none --arch=x86_32 --enable-cross-compile --disable-asm --disable-stripping --disable-programs --disable-doc --disable-debug --disable-runtime-cpudetect --disable-autodetect --nm=emnm --ar=emar --ranlib=emranlib --cc=emcc --cxx=em++ --objcc=emcc --dep-cc=emcc --extra-cflags='-I/opt/include -O3 -msimd128' --extra-cxxflags='-I/opt/include -O3 -msimd128' --disable-pthreads --disable-w32threads --disable-os2threads --enable-gpl --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libopus --enable-zlib --enable-libwebp --enable-libfreetype --enable-libfribidi --enable-libass --enable-libzimg index.tsx:81:20
ffmpeg >>>    libavutil      57. 28.100 / 57. 28.100 index.tsx:81:20
ffmpeg >>>    libavcodec     59. 37.100 / 59. 37.100 index.tsx:81:20
ffmpeg >>>    libavformat    59. 27.100 / 59. 27.100 index.tsx:81:20
ffmpeg >>>    libavdevice    59.  7.100 / 59.  7.100 index.tsx:81:20
ffmpeg >>>    libavfilter     8. 44.100 /  8. 44.100 index.tsx:81:20
ffmpeg >>>    libswscale      6.  7.100 /  6.  7.100 index.tsx:81:20
ffmpeg >>>    libswresample   4.  7.100 /  4.  7.100 index.tsx:81:20
ffmpeg >>>    libpostproc    56.  6.100 / 56.  6.100 index.tsx:81:20
ffmpeg >>>  Input #0, matroska,webm, from 'input.webm': index.tsx:81:20
ffmpeg >>>    Metadata: index.tsx:81:20
ffmpeg >>>      encoder         : QTmuxingAppLibWebM-0.0.1 index.tsx:81:20
ffmpeg >>>    Duration: N/A, start: 0.000000, bitrate: N/A index.tsx:81:20
ffmpeg >>>    Stream #0:0(eng): Video: vp8, yuv420p(progressive), 640x480, SAR 1:1 DAR 4:3, 15.50 tbr, 1k tbn (default)


    


    the problem is when ffmpeg.wasm try to execute the last command.
    
await ffmpeg?.exec(['-re', '-i', 'input.webm', '-c', 'copy', '-f', 'flv', "rtmp://localhost:1935/live/ttt"]).
    
it just calls a GET Request, I will send further details about this request.
    
as u can see, i try to use lots of arg sample with ffmpeg?.exec, but non of them works.

    


    the network tab in browser, after ffmpeg.wasm execute the command is as below.

    


    enter image description here

    


    it send a GET request to ws://localhost:1935/
and nothing happened after that.

    


    for backend, i use node-media-server and here is my output logs when ffmpeg.wasm trying to execute the args

    


    11/28/2023 19:33:18 55301 [INFO] [rtmp disconnect] id=JL569YOF
[NodeEvent on doneConnect] id=JL569YOF args=undefined


    


    at last here are my ques

    


    

      

    • how can i achive this option ?
    • 


    • is it possible to share webcam to rtmp server ?
    • 


    


    


  • ffmpeg : Strange behaviour with fade-in and fade-out in conjunction vs successively

    29 novembre 2023, par CEr

    I have a video file I want to fade in and out over a duration of three seconds each.

    


    My code is :

    


    ffmpeg -i video.mp4 -vf "fade=t=in:st=0:d=3,fade=t=out:st=169.288000:d=3" videofaded.mp4

    


    Expected behaviour : Fade from and to black over 3s.
What I get : No fade in at all but a fade out as specified.

    


    If I run ffmpeg -i video.mp4 -vf "fade=t=in:st=0:d=3" -c:a copy fadein.mp4 to juste fade in everything works as expected.

    


    Can anybody help my identify the problem ? I want to fade in and out in the same turn as there are a couple of videos to edit.

    


    Thanks,
Chris

    


    Here is my ffmpeg output :

    


    ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fffda8a7300] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1920x1080, 1087 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20231106_Einfuehrung_Word_Mark_Fragen.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:02:52.29, start: 0.016000, bitrate: 1126 kb/s
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 1920x1080, 1087 kb/s, 16 fps, 16 tbr, 10k tbn, 20k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 72 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
File 'videofaded.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7fffda8c2c40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
[libx264 @ 0x7fffda8c2c40] profile High, level 4.0
[libx264 @ 0x7fffda8c2c40] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=24 lookahead_threads=4 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=16 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
Output #0, mp4, to 'videofaded.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
    Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080, q=-1--1, 16 fps, 16384 tbn, 16 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.54.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 69 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.54.100 aac
frame= 2757 fps=273 q=-1.0 Lsize=   21394kB time=00:02:52.28 bitrate=1017.2kbits/s dup=92 drop=0 speed=17.1x
video:19842kB audio:1492kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.280957%
[libx264 @ 0x7fffda8c2c40] frame I:12    Avg QP:15.18  size:232156
[libx264 @ 0x7fffda8c2c40] frame P:1751  Avg QP:20.38  size:  9540
[libx264 @ 0x7fffda8c2c40] frame B:994   Avg QP:23.59  size:   832
[libx264 @ 0x7fffda8c2c40] consecutive B-frames: 40.7% 29.5% 13.1% 16.8%
[libx264 @ 0x7fffda8c2c40] mb I  I16..4: 44.5% 15.6% 39.9%
[libx264 @ 0x7fffda8c2c40] mb P  I16..4:  0.5%  0.2%  0.2%  P16..4:  9.3%  1.1%  1.0%  0.0%  0.0%    skip:87.8%
[libx264 @ 0x7fffda8c2c40] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8:  6.2%  0.2%  0.1%  direct: 0.1%  skip:93.1%  L0:31.0% L1:66.2% BI: 2.9%
[libx264 @ 0x7fffda8c2c40] 8x8 transform intra:20.6% inter:17.2%
[libx264 @ 0x7fffda8c2c40] coded y,uvDC,uvAC intra: 40.5% 40.6% 18.4% inter: 3.2% 2.1% 0.3%
[libx264 @ 0x7fffda8c2c40] i16 v,h,dc,p: 40% 33%  8% 19%
[libx264 @ 0x7fffda8c2c40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 14% 43%  2%  1%  1%  1%  1%  2%
[libx264 @ 0x7fffda8c2c40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 32% 15%  2%  3%  3%  3%  3%  3%
[libx264 @ 0x7fffda8c2c40] i8c dc,h,v,p: 56% 20% 19%  5%
[libx264 @ 0x7fffda8c2c40] Weighted P-Frames: Y:0.7% UV:0.7%
[libx264 @ 0x7fffda8c2c40] ref P L0: 85.4%  5.7%  6.2%  2.7%  0.0%
[libx264 @ 0x7fffda8c2c40] ref B L0: 79.1% 18.3%  2.6%
[libx264 @ 0x7fffda8c2c40] ref B L1: 96.6%  3.4%
[libx264 @ 0x7fffda8c2c40] kb/s:943.30
[aac @ 0x7fffda8f1e00] Qavg: 18927.953


    


  • Extract all audio from a mov file into a aac file [closed]

    5 février 2024, par Sushrut Kaul

    I have a video which contains several streams as shown below :

    


    Stream #0:0[0x1](eng): Video: prores (XQ) (ap4x / 0x78347061), yuv444p12le(bt709/smpte432/smpte2084, progressive), 3840x2160, 1222881 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2022-08-26T22:20:26.000000Z
      handler_name    : Apple Video Media Handler
      vendor_id       : appl
      encoder         : Apple ProRes 4444 XQ
      timecode        : 00:59:59:00
    Side data:
      Content Light Level Metadata, MaxCLL=726, MaxFALL=93
  Stream #0:1[0x2](eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (FL), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2022-08-26T22:20:26.000000Z
      handler_name    : Apple Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (FR), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2022-08-26T22:20:26.000000Z
      handler_name    : Apple Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:3[0x4](eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2022-08-26T22:20:26.000000Z
      handler_name    : Apple Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:4[0x5](eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (LFE), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2022-08-26T22:20:26.000000Z
      handler_name    : Apple Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:5[0x6](eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (BL), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2022-08-26T22:20:26.000000Z
      handler_name    : Apple Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:6[0x7](eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (BR), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2022-08-26T22:20:26.000000Z
      handler_name    : Apple Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:7[0x8](eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (DL), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2022-08-26T22:20:26.000000Z
      handler_name    : Apple Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:8[0x9](eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (DR), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2022-08-26T22:20:26.000000Z
      handler_name    : Apple Sound Media Handler
      vendor_id       : [0][0][0][0]


    


    As you can see, these audio streams are single channel as each stream is mapping to a unique channel.

    


    I want to combine these audio streams into a aac file such that the output has the channel information retained.

    


    I use the following command to do this :

    


    ffmpeg -i -filter _complex "[0:a:0][0:a:1][0:a:2][0:a:3][0:a:4][0:a:5][0:a:6][0:a:7]join=inputs=8:channel_layout=7.1[aout]" -map "[aout]" -c:a aac output_audio_join.aac

    


    The individual audio streams were having a duration of duration=103.728625 seconds.

    


    The output however is 862.207660 seconds. Why ?