Recherche avancée

Médias (1)

Mot : - Tags -/bug

Autres articles (30)

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

  • MediaSPIP Player : problèmes potentiels

    22 février 2011, par

    Le lecteur ne fonctionne pas sur Internet Explorer
    Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
    Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)

  • MediaSPIP Player : les contrôles

    26 mai 2010, par

    Les contrôles à la souris du lecteur
    En plus des actions au click sur les boutons visibles de l’interface du lecteur, il est également possible d’effectuer d’autres actions grâce à la souris : Click : en cliquant sur la vidéo ou sur le logo du son, celui ci se mettra en lecture ou en pause en fonction de son état actuel ; Molette (roulement) : en plaçant la souris sur l’espace utilisé par le média (hover), la molette de la souris n’exerce plus l’effet habituel de scroll de la page, mais diminue ou (...)

Sur d’autres sites (6776)

  • Replicating C metadata example from ffmpeg in C# using ffmpeg-autogen - av_dict_get fails

    2 octobre 2017, par Adam Baxter

    I am trying to replicate https://ffmpeg.org/doxygen/3.0/doc_2examples_2metadata_8c_source.html in C# using the wrapper from https://github.com/Ruslan-B/FFmpeg.AutoGen

    I can open and read some properties of the file just fine, however tag is always null, even after the call to av_dict_get

    My code is as follows

    using System;
    using System.IO;
    using System.Reflection;
    using System.Runtime.InteropServices;
    using System.Text;
    using FFmpeg.AutoGen;

    namespace ffmpeg_test
    {
       class Program
       {
           static void Main(string[] args)
           {
               var currentPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
               var libPath = Path.Combine(currentPath, "lib");
               SetDllDirectory(libPath);
               ffmpeg.av_register_all();
               ffmpeg.avcodec_register_all();

               DoRiskyThings();

           }

           private static unsafe void DoRiskyThings()
           {
               var pFormatContext = ffmpeg.avformat_alloc_context();

               if (ffmpeg.avformat_open_input(&pFormatContext, "01 - 999,999.opus", null, null) != 0)
                   throw new ApplicationException(@"Could not open file.");

               ffmpeg.avformat_find_stream_info(pFormatContext, null);

               AVStream* pStream = null;
               pStream = pFormatContext->streams[0];
               var codecContext = *pStream->codec;

               Console.WriteLine($"codec name: {ffmpeg.avcodec_get_name(codecContext.codec_id)}");
               Console.WriteLine($"number of streams: {pFormatContext->nb_streams}");

               //attempting to replicate https://ffmpeg.org/doxygen/3.0/doc_2examples_2metadata_8c_source.html
               AVDictionaryEntry* tag = null;
               tag = ffmpeg.av_dict_get(pFormatContext->metadata, "", null, 2);
               while (tag != null)
               {
                   tag = ffmpeg.av_dict_get(pFormatContext->metadata, "", tag, 2);
                   Console.WriteLine(Encoding.UTF8.GetString(tag->key,100));
                   //tag->key and //tag->value are byte pointers
               }
           }

           [DllImport("kernel32", SetLastError = true)]
           private static extern bool SetDllDirectory(string lpPathName);
       }
    }
  • MediaRecorder - FFMPEG - RTMP issue

    5 octobre 2017, par Bear10

    Currently I’m working on streaming Audio and Video from a video captured in Chrome 61.0.3163.100 with the MediaRecorder API.

    The backend is running on node and it spawns a child process which runs ffmpeg :

    ffmpeg -threads 4 -i udp://127.0.0.1:41234 -t 5400 -ar 44100
    -b:a 128k -c:v libx264 -c:a libfdk_aac -pix_fmt yuv420p -r 30 -g 60 -vb 2048k -preset slow -minrate 2000k -maxrate 4000k test.mp4

    On the client side I send the raw Blob from Chrome to the Node server via web socket :

    var mediaStream = new MediaStream([videoOutput.getVideoTracks()[0], audioOutput.getAudioTracks()[0]]),
               recorder = new MediaRecorder(mediaStream, {
                   mimeType: 'video/webm;codecs=vp8'
               });

           socket = io('http://localhost:' + port);

           recorder.addEventListener('dataavailable', function (evt) {
               socket.emit('video:data', evt.data);
           });

    And in Node we simply resend via udp to the ffmpeg process :

    let client = dgram.createSocket('udp4'),

    client.send(chunk, 0, chunk.length, 41234, '127.0.0.1', function (err, bytes) {
               if (err) {
                   throw err;
               }
           });

    The resulting mp4 is viewable on VLC without any issues, despite many of the following warnings showing up in the FFMPEG console :

    stderr: frame= 1751 fps= 31 q=17.0 size=   15997kB time=00:00:58.39 bitrate=2244.3kbits/s dup=449 drop=32 speed=1.03x
    stderr: [mp4 @ 0x7fefe6019000] Non-monotonous DTS in output stream 0:1; previous: 2573919, current: 2573792; changing to 2573920. This may result in incorrect timestamps in the output file.

    stderr: frame= 1767 fps= 31 q=17.0 size=   16166kB time=00:00:58.90 bitrate=2248.4kbits/s dup=452 drop=32 speed=1.03x
    stderr: [libmp3lame @ 0x7fefe7004c00] Queue input is backward in time

    stderr: [mp4 @ 0x7fefe6019000] Non-monotonous DTS in output stream 0:1; previous: 2614768, current: 2614686; changing to 2614769. This may result in incorrect timestamps in the output file.

    However when I try to re stream this specific video on Youtube or any other RTMP platform (ex : Facebook) the audio is choppy, the command I use :

    ffmpeg -i ./test.mp4 -f flv rtmp://a.rtmp.youtube.com/live2/MYAPIKEY

    On the other hand any other "good" video not made from the aforementioned process re streams just fine and I suspect it might be from the warnings I’m getting.

    As an added bit of information streaming directly from my PC with avfoundation to youtube also works fine, and writing from avfoundation to a file and then streaming to youtube also works ok.

    The goal is to stream from my browser to the node server and directly to the Youtube RTMP without the choppy audio issue.

    If someone knows how to get rid of the warning to ensure ffmpeg isn’t the issue or can point me in the direction to achieve the desired result that’d be great.

  • Matplotlib : ValueError : I/O operation on closed file [duplicate]

    28 septembre 2017, par gopi

    This question is an exact duplicate of :

    %matplotlib inline
    import math,os,sys,numpy as np
    from numpy.random import random
    from matplotlib import pyplot as plt, rcParams, animation, rc
    from __future__ import print_function, division
    from ipywidgets import interact, interactive, fixed
    from ipywidgets.widgets import *
    rc('animation', html='html5')
    rcParams['figure.figsize'] = 3,3
    %precision 4
    np.set_printoptions(precision=4, linewidth=100)

    def lin(a,x,b): return a * x + b

    a = 3.
    b = 8.
    n = 30

    x = random(n)
    y = lin(a,x,b)

    plt.scatter(x,y)

    def sse(y, y_pred): return ((y-y_pred)**2).sum()
    def loss(y, a, x, b): return sse(y, lin(a, x, b))
    def avg_loss(y, a, x, b): return np.sqrt(loss(y, a, x, b)/n)

    a_guess = -1
    b_guess = 1
    avg_loss(y, a_guess, x, b_guess)

    lr = 0.01
    #d[(y-(a*x+b))**2, b] = 2 (y_pred - y)
    #d[(y -(a*x+b)) **2, a] = x * dy/db

    def upd():
       global a_guess, b_guess
       y_pred = lin(a_guess, x, b_guess)
       dydb = 2 * (y_pred - y)
       dyda = x * dydb
       a_guess -= lr*dyda.mean()
       b_guess -= lr*dydb.mean()


    fig = plt.figure(dpi=100, figsize=(5,5))
    plt.scatter(x,y)
    line, = plt.plot(x, lin(a_guess, x, b_guess))
    plt.close()

    def animate(i):
       line.set_ydata(lin(a_guess, x, b_guess))
       for i in range(10): upd()
       return line,


    ani = animation.FuncAnimation(fig, animate, np.arange(0, 40), interval=100)
    ani

    But when I run it I get the following error,

       ValueError Traceback (most recent call last)
    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
       309             method = get_real_method(obj, self.print_method)
       310             if method is not None:
    --> 311                 return method()
       312             return None
       313         else:

    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/site-packages/matplotlib/animation.pyc in _repr_html_(self)
      1233         fmt = rcParams['animation.html']
      1234         if fmt == 'html5':
    -> 1235             return self.to_html5_video()
      1236
      1237

    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/site-packages/matplotlib/animation.pyc in to_html5_video(self)
      1207                                 bitrate=rcParams['animation.bitrate'],
      1208                                 fps=1000. / self._interval)
    -> 1209                 self.save(f.name, writer=writer)
      1210
      1211             # Now open and base64 encode

    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/site-packages/matplotlib/animation.pyc in save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs)
      1061                         # TODO: See if turning off blit is really necessary
      1062                         anim._draw_next_frame(d, blit=False)
    -> 1063                     writer.grab_frame(**savefig_kwargs)
      1064
      1065         # Reconnect signal for first draw if necessary

    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/contextlib.pyc in __exit__(self, type, value, traceback)
        33                 value = type()
        34             try:
    ---> 35                 self.gen.throw(type, value, traceback)
        36                 raise RuntimeError("generator didn't stop after throw()")
        37             except StopIteration, exc:

    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/site-packages/matplotlib/animation.pyc in saving(self, *args, **kw)
       287             yield self
       288         finally:
    --> 289             self.finish()
       290
       291     def _run(self):

    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/site-packages/matplotlib/animation.pyc in finish(self)
       307     def finish(self):
       308         'Finish any processing for writing the movie.'
    --> 309         self.cleanup()
       310
       311     def grab_frame(self, **savefig_kwargs):

    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/site-packages/matplotlib/animation.pyc in cleanup(self)
       346     def cleanup(self):
       347         'Clean-up and collect the process used to write the movie file.'
    --> 348         out, err = self._proc.communicate()
       349         self._frame_sink().close()
       350         verbose.report('MovieWriter -- '

    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/site-packages/subprocess32.pyc in communicate(self, input, timeout)
       925
       926         try:
    --> 927             stdout, stderr = self._communicate(input, endtime, timeout)
       928         finally:
       929             self._communication_started = True

    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/site-packages/subprocess32.pyc in _communicate(self, input, endtime, orig_timeout)
      1711             if _has_poll:
      1712                 stdout, stderr = self._communicate_with_poll(input, endtime,
    -> 1713                                                              orig_timeout)
      1714             else:
      1715                 stdout, stderr = self._communicate_with_select(input, endtime,

    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/site-packages/subprocess32.pyc in _communicate_with_poll(self, input, endtime, orig_timeout)
      1767             select_POLLIN_POLLPRI = select.POLLIN | select.POLLPRI
      1768             if self.stdout:
    -> 1769                 register_and_append(self.stdout, select_POLLIN_POLLPRI)
      1770                 stdout = self._fd2output[self.stdout.fileno()]
      1771             if self.stderr:

    /home/gopinath/Workspace/anaconda3/envs/py27/lib/python2.7/site-packages/subprocess32.pyc in register_and_append(file_obj, eventmask)
      1746             poller = select.poll()
      1747             def register_and_append(file_obj, eventmask):
    -> 1748                 poller.register(file_obj.fileno(), eventmask)
      1749                 self._fd2file[file_obj.fileno()] = file_obj
      1750

    ValueError: I/O operation on closed file

    I almost tried everywhere and I couldn’t find a solution, I tried reinstalling ffmpeg from the sources, moved this file to the folder where I installed ffmpeg and gave a try.

    I’m using python 3.5,
    Ubuntu 16.04
    Anaconda 4.4
    Matplotlib 2.02

    actually this particular course was taught using python 2.7 so I created a virenv installed 2.7 along with all related dependencies. So will it be the problem ?? I mean using python 2.7 on top of 3.5 ?