Recherche avancée

Médias (1)

Mot : - Tags -/illustrator

Autres articles (65)

  • 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

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

  • Formulaire personnalisable

    21 juin 2013, par

    Cette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
    Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire. (...)

Sur d’autres sites (8663)

  • HOW TO APPLY TRANSITION EFFECTS IN FFMPEG ? [closed]

    8 janvier 2023, par SMART

    I have 7 videos with audio, i tried to apply transition effects on these files, written code in python for this , i got error .

    


    python code :
import subprocess as sp

    


        def runffmpeg(cmd):
        try:
            pipe = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.STDOUT,
                            universal_newlines=True)
    
            ffmpeg_output, _ = pipe.communicate()
    
            print(ffmpeg_output)
            return (ffmpeg_output)
    
        except sp.CalledProcessError as err:
            print("FFmpeg stdout output on error:\n" + err.output)
    
    def get_duration(fn):
        cmd = (
            f"ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 {fn}")
    
        cmd1 = (
            f"ffprobe -v error -of flat=s_ -select_streams 1 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 {fn}")
        try:
            pipe = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.STDOUT,
                            universal_newlines=True)
    
            viddur, _ = pipe.communicate()
    
            print(viddur)
    
            pipe = sp.Popen(cmd1, stdout=sp.PIPE, stderr=sp.STDOUT,
                            universal_newlines=True)
    
            auddur, _ = pipe.communicate()
    
            try:
                auddur = float(auddur.strip())
            except:
                auddur = 0
    
            print(auddur)
    
            # if (len(auddur) == 0):
            #     auddur = 0
    
            return float(viddur.strip()), (auddur)
    
        except sp.CalledProcessError as err:
            print("FFmpeg stdout output on error:\n" + err.output)
    
    
    def trans(clips, effects, out="trans.mp4"):
        filtc = " [v1][v2]xfade=wipedown:duration=1:offset=4[x1];"
        i = 0
        fcv = ""
        fca = ""
        d1 = 0
        af = ""
        dur = []
        aud = []
        inp = ""
        j = 0
        print(len(clips))
    
        for x in clips:
            print(x[0])
            inp = (inp + " -i " + x)
    
            print(effects[0])
            print(x)
    
            v, a = get_duration(fn=x)
            dur.append(v)
    
        k = 0
        for x in dur:
    
            if (k == 0):
                fca = (fca + f"[{k}:a]adelay=0|0 [a{k+1}];")
            else:
                fca = (fca + f"[{k}:a]adelay={d1}|{d1} [a{k+1}];")
            aud.append(f"[a{k+1}]")
            k = (k+1)
            d1 = (d1+((x*1000)+3.5))
    
        d1 = 0
        for x in efects:
            for v in range(0, j+1, +1):
                d1 = (d1 + dur[v])
                d1 = (d1-((v+1)*3.5))
            # [0:a]adelay=0|0 [a1];
            if (i > 1):
    
                try:
                    fcv = (
                        fcv+f"[x{(i)}][{(i)}:v]xfade={x}:duration=3:offset={d1} [x{(i+1)}];")
                except:
                    pass
            else:
                print("j = %d" % j)
                fcv = (
                    fcv+f"[{(i)}:v][{(i+1)}:v]xfade={x}:duration=3:offset={d1} [x{(i+1)}];")
    
            j = (j+1)
            i = (i+1)
    
        for a in aud:
            af = (af+a)
        af = (af+f"amix=inputs={len(aud)} [faud]")
    
        inp = (inp+" -filter_complex \"")
        cmd = (
            f"ffmpeg {inp} {fcv} {fca} {af} \" -pix_fmt yuv420p -map \"[x{i}]\" -map \"[faud]\" -y {out}")
    
        print(cmd)
    
        try:
            pipe = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.STDOUT,
                            universal_newlines=True)
    
            ffmpeg_output, _ = pipe.communicate()
    
            print(ffmpeg_output)
    
        except sp.CalledProcessError as err:
            print("FFmpeg stdout output on error:\n" + err.output)
            
            


    


    these functions creates ffmpeg code like :
ffmpeg -i out1.mp4 -i out2.mp4 -i out3.mp4 -i out4.mp4 -i out5.mp4 -i out6.mp4 -i out7.mp4 -filter_complex " [0:v][1:v]xfade=wipedown:duration=3:offset=6.006009000000001 [x1] ;[1:v][2:v]xfade=dissolve:duration=3:offset=14.030023 [x2] ;[x2][2:v]xfade=pixelize:duration=3:offset=20.572042000000003 [x3] ;[x3][3:v]xfade=vuslice:duration=3:offset=21.621068000000008 [x4] ;[x4][4:v]xfade=radial:duration=3:offset=14.188099000000015 [x5] ;[x5][5:v]xfade=vertopen:duration=3:offset=-5.737862999999978 [x6] ; [0:a]adelay=0|0 [a1] ;[1:a]adelay=9509.509|9509.509 [a2] ;[2:a]adelay=18531.014000000003|18531.014000000003 [a3] ;[3:a]adelay=27552.519000000004|27552.519000000004 [a4] ;[4:a]adelay=36063.026000000005|36063.026000000005 [a5] ;[5:a]adelay=45084.531|45084.531 [a6] ;[6:a]adelay=53595.038|53595.038 [a7] ; [a1][a2][a3][a4][a5][a6][a7]amix=inputs=7 [faud] " -pix_fmt yuv420p -map "[x6]" -map "[faud]" -y trans.mp4

    


    this ffmpeg command generates error :

    


        ffmpeg version 2022-12-25-git-eeb280f351-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
      built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
      configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
      libavutil      57. 43.100 / 57. 43.100
      libavcodec     59. 55.103 / 59. 55.103
      libavformat    59. 34.102 / 59. 34.102
      libavdevice    59.  8.101 / 59.  8.101
      libavfilter     8. 53.100 /  8. 53.100
      libswscale      6.  8.112 /  6.  8.112
      libswresample   4.  9.100 /  4.  9.100
      libpostproc    56.  7.100 / 56.  7.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out1.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf59.34.102
      Duration: 00:00:09.51, start: 0.000000, bitrate: 1358 kb/s
      Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/unknown/unknown, progressive), 1080x1920, 1303 kb/s, 26.94 fps, 25 tbr, 1000k tbn (default)
        Metadata:
          handler_name    : VideoHandler
          vendor_id       : [0][0][0][0]
          encoder         : Lavc59.55.103 libx264
      Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 51 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
          vendor_id       : [0][0][0][0]
    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'out2.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf59.34.102
      Duration: 00:00:09.02, start: 0.000000, bitrate: 1060 kb/s
      Stream #1:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/unknown/unknown, progressive), 1080x1920, 1007 kb/s, 26.73 fps, 25 tbr, 1000k tbn (default)
        Metadata:
          handler_name    : VideoHandler
          vendor_id       : [0][0][0][0]
          encoder         : Lavc59.55.103 libx264
      Stream #1:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 47 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
          vendor_id       : [0][0][0][0]
    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'out3.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf59.34.102
      Duration: 00:00:09.02, start: 0.000000, bitrate: 1228 kb/s
      Stream #2:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/unknown/unknown, progressive), 1080x1920, 1178 kb/s, 26.73 fps, 25 tbr, 1000k tbn (default)
        Metadata:
          handler_name    : VideoHandler
          vendor_id       : [0][0][0][0]
          encoder         : Lavc59.55.103 libx264
      Stream #2:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 46 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
          vendor_id       : [0][0][0][0]
    Input #3, mov,mp4,m4a,3gp,3g2,mj2, from 'out4.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf59.34.102
      Duration: 00:00:08.51, start: 0.000000, bitrate: 987 kb/s
      Stream #3:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/unknown/unknown, progressive), 1080x1920, 938 kb/s, 26.57 fps, 25 tbr, 1000k tbn (default)
        Metadata:
          handler_name    : VideoHandler
          vendor_id       : [0][0][0][0]
          encoder         : Lavc59.55.103 libx264
      Stream #3:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 43 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
          vendor_id       : [0][0][0][0]
    Input #4, mov,mp4,m4a,3gp,3g2,mj2, from 'out5.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf59.34.102
      Duration: 00:00:09.02, start: 0.000000, bitrate: 1221 kb/s
      Stream #4:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/unknown/unknown, progressive), 1080x1920, 1170 kb/s, 26.73 fps, 25 tbr, 1000k tbn (default)
        Metadata:
          handler_name    : VideoHandler
          vendor_id       : [0][0][0][0]
          encoder         : Lavc59.55.103 libx264
      Stream #4:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 47 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
          vendor_id       : [0][0][0][0]
    Input #5, mov,mp4,m4a,3gp,3g2,mj2, from 'out6.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf59.34.102
      Duration: 00:00:08.51, start: 0.000000, bitrate: 1073 kb/s
      Stream #5:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/unknown/unknown, progressive), 1080x1920, 1027 kb/s, 26.57 fps, 25 tbr, 1000k tbn (default)
        Metadata:
          handler_name    : VideoHandler
          vendor_id       : [0][0][0][0]
          encoder         : Lavc59.55.103 libx264
      Stream #5:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 41 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
          vendor_id       : [0][0][0][0]
    Input #6, mov,mp4,m4a,3gp,3g2,mj2, from 'out7.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf59.34.102
      Duration: 00:00:09.02, start: 0.000000, bitrate: 757 kb/s
      Stream #6:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt470bg/unknown/unknown, progressive), 1080x1920, 705 kb/s, 26.73 fps, 25 tbr, 1000k tbn (default)
        Metadata:
          handler_name    : VideoHandler
          vendor_id       : [0][0][0][0]
          encoder         : Lavc59.55.103 libx264
      Stream #6:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 46 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
          vendor_id       : [0][0][0][0]
    Filter xfade:default has an unconnected output


    


    Filter xfade:default has an unconnected output , what does it mean ?

    


    in adelay area , getting -ve nos , what to do ?

    


    #useage :

    


    vc = ["C1.mp4", "C2.mp4", "C3.mp4", "C4.mp4", "C5.mp4", "C6.mp4", "C7.mp4"]

    


        i = 1
    gc = []
    for x in vc:
        gc.append(f"out{i}.mp4")
        i = (i+1)
    
    print(gc)
    
    trans(clips=gc, effects=efects)


    


    system details :
windows 10 64 bits
python 3.9 64 bits

    


  • NodeJS : Fail to write byte array input from webcam to ffmpeg spawn process

    23 mai 2024, par Thanesh Prabaghan

    I'm using NodeJS server to display an HTML page which has webcam option. Once user visited to my NodeJS server, it will serve html page. User can allow webcam option and see webcam view on the page.

    


    In the backend, I send webcam stream (byte array) using socket.io. I receive byte array successfully in backend with the help of socket.io. BUT MY PROBLEM IS, I can't pipe this byte array to the ffmpeg spawn process. I don't know how to properly pipe this data to the ffmpeg. Once it done, all my problem will be solved.

    


    On the other side, I have node-media-server as RTMP server to publish this stream to VLC player and other devices. Kindly help me to complete this task. I will attach all my code to this question. Kindly run this in your environment and answer the question.

    


    MY HTML PAGE

    


    &#xA;&#xA;  &#xA;    &#xA;      &#xA;&#xA;      &#xA;&#xA;      <code class="echappe-js">&lt;script src=&quot;https://cdn.socket.io/4.7.5/socket.io.min.js&quot; &amp;#xA;        integrity=&quot;integrity_code&quot; &amp;#xA;        crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;&#xA;    &#xA;    &#xA;      
    &#xA; &#xA;&#xA; &lt;script&gt;&amp;#xA;          const socket = io(&amp;#x27;http://localhost:8080/&amp;#x27;);&amp;#xA;          var video = document.getElementById(&quot;video&quot;);&amp;#xA;&amp;#xA;          if (navigator.mediaDevices.getUserMedia) {&amp;#xA;            navigator.mediaDevices.getUserMedia({ video: true, audio:true })&amp;#xA;            .then(function (stream) {&amp;#xA;              const recorder = new MediaRecorder(stream);&amp;#xA;&amp;#xA;              recorder.ondataavailable = event =&gt; {&amp;#xA;                socket.emit(&amp;#x27;VideoStream&amp;#x27;, event.data);&amp;#xA;              };&amp;#xA;              recorder.start(1000);      &amp;#xA;              video.srcObject = stream;&amp;#xA;            }).catch(function (error) {&amp;#xA;              console.log(&quot;Something went wrong!&quot;);&amp;#xA;            });&amp;#xA;         }  &amp;#xA;       &lt;/script&gt;&#xA; &#xA;&#xA;&#xA;

    &#xA;

    FFMPEG IMPLEMENTATION

    &#xA;

    const express = require(&#x27;express&#x27;);&#xA;const app = express();&#xA;const http = require(&#x27;http&#x27;);&#xA;const server = http.createServer(app);&#xA;const { Server } = require("socket.io");&#xA;const io = new Server(server);&#xA;const path = require(&#x27;node:path&#x27;); &#xA;const { spawn } = require(&#x27;node:child_process&#x27;);&#xA;&#xA;let cmd = spawn(&#x27;ffmpeg.exe&#x27;, [&#xA;    &#x27;-c:v&#x27;, &#x27;copy&#x27;, &#x27;-preset&#x27;, &#x27;ultrafast&#x27;, &#x27;-tune&#x27;, &#x27;zerolatency&#x27;,&#xA;    &#x27;-c:a&#x27;, &#x27;aac&#x27;, &#x27;-strict&#x27;, &#x27;-2&#x27;, &#x27;-ar&#x27;, &#x27;44100&#x27;, &#x27;-b:a&#x27;, &#x27;64k&#x27;,&#xA;    &#x27;-y&#x27;,&#xA;    &#x27;-use_wallclock_as_timestamps&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-async&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-flush_packets&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-rtbufsize&#x27;, &#x27;1000&#x27;,&#xA;    &#x27;-bufsize&#x27;, &#x27;1000&#x27;,&#xA;    &#x27;-f&#x27;, &#x27;flv&#x27;,&#xA;     &#x27;-i&#x27;,&#x27;-&#x27;,&#xA;    &#x27;rtmp://localhost:1935&#x27;,&#xA;  ]);&#xA;&#xA;app.use(express.static(path.join(__dirname, &#x27;public&#x27;)));&#xA;&#xA;app.get(&#x27;/&#x27;, (req, res) => {&#xA;  res.sendFile(path.join(__dirname &#x2B; &#x27;index.html&#x27;));&#xA;});&#xA;&#xA;io.on(&#x27;connection&#x27;, (socket) => {&#xA;  socket.on("VideoStream", (data) => {&#xA;    cmd.stdin.write(data);&#xA;  });&#xA;});&#xA;&#xA;server.listen(8080, () => {&#xA;  console.log(&#x27;listening on *:8080&#x27;);&#xA;});&#xA;&#xA;```&#xA;**NODE MEDIA SERVER IMPLEMENTATION**&#xA;&#xA;```&#xA;const NodeMediaServer = require(&#x27;node-media-server&#x27;);&#xA;&#xA;const config = {&#xA;  rtmp: {&#xA;    port: 1935,&#xA;    chunk_size: 60000,&#xA;    gop_cache: true,&#xA;    ping: 30,&#xA;    ping_timeout: 60&#xA;  },&#xA;  http: {&#xA;    port: 8000,&#xA;    allow_origin: &#x27;*&#x27;&#xA;  }&#xA;};&#xA;&#xA;var nms = new NodeMediaServer(config)&#xA;nms.run();&#xA;```&#xA;&#xA;&#xA;

    &#xA;

  • Convert Blob audio file to mp3 type in typescript

    6 avril 2022, par I. Albuquerque

    I'm trying to convert a blob audio file to .mp3 type which is generated from MediaRecorder it is returning with webm type and I have tried other types in MimeType(attribute in MediaRecorder to set the type) but they are not supported so I have tried ffmpeg npm library but it was asking for path of the file but i'm not saving it so that also didn't work for me. Any suggestion and answer that will help !!

    &#xA;

    Here is how i get audio

    &#xA;

    getAudio(){&#xA;  navigator.mediaDevices.getUserMedia({ audio: true})&#xA;    .then( stream => {&#xA;      console.log(stream)&#xA;      this.mediaRecord = new MediaRecorder(stream)&#xA;&#xA;      this.mediaRecord.ondataavailable = (data: { data: any; }) => {&#xA;        console.log(data)&#xA;        this.chunks.push(data.data)&#xA;      }&#xA;&#xA;      this.mediaRecord.onstop = () => {&#xA;        const blob = new Blob(this.chunks, { type: &#x27;audio/mp3&#x27;})&#xA;        const reader = new window.FileReader()&#xA;        reader.readAsDataURL(blob)&#xA;        reader.onloadend = () => {&#xA;          const teste:any = this.$el.querySelector(&#x27;#teste&#x27;)&#xA;          teste.src = reader.result //render.result e o local onde o audio fica armazenado&#xA;          this.ArquivoAudio = blob&#xA;          console.log(reader.result)&#xA;        }&#xA;      }&#xA;    }, err => {&#xA;      console.log(err)&#xA;      alert(&#x27;voce deve permitir a captura de audio&#x27;)&#xA;    })&#xA;},&#xA;

    &#xA;