Recherche avancée

Médias (1)

Mot : - Tags -/berlin

Autres articles (67)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • 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

Sur d’autres sites (8590)

  • FFMpeg transcoding for realtime videochat via UDP

    4 septembre 2018, par Lloyd Corfex

    My problem is that I can’t find settings matching my needs.
    I know there is a tradeoff between : Speed, Quality and Size.

    (I am using a wrapper, so I can’t tell you the exact ffmpeg string but it should be comprehensible.)

    Input is always a raw video (bitmaps provided by webcam).

    CustomInputArgs = string.Format(" -pix_fmt bgr24 -video_size {0}x{1}", bitmapSize.Width, bitmapSize.Height),
    CustomOutputArgs = string.Format(" -vf scale=-1:{0} -maxrate 3000k -bufsize 4500k -preset ultrafast -tune zerolatency -movflags faststart", scale)

    Format : H.264

    • Speed -> ok
    • Size -> ok
    • Quality -> Not okay - Result gets "blocky" / "pixelchaos"


    [https://www.pic-upload.de/view-35890878/HalloPixel.jpg.html
    ]

    Format : H.265 and AVI

    • Speed -> Way too slow

    Format : FLV

    • Results in only a black screen (even if i set one of the following to the encoder)
      [https://stackoverflow.com/a/12290903/10144526]

      CustomOutputArgs = " -pix_fmt yuv420p"

      CustomOutputArgs = " -pix_fmt yuyv422"

    • As long as i have any string in the encoder outputArgs i get the following error in ffmpeg : [flv @ 03c27e40] Packet mismatch 1239459658 55255 55450

    Format MJPEG

    • Quality -> Super
    • Speed -> Ok
    • Size -> Gigantic

    Format M4V

    • Quality -> Not good
    • Speed -> Ok
    • Size -> Ok

    Format MP4

    • Conversion failed

    Does anyone has an idea about good settings ? Or can advice me in a good direction ?

  • How do I properly enable ffmpeg for matplotlib.animation ?

    9 novembre 2018, par spanishgum

    I have covered a lot of ground on stack so far trying to get ffmpeg going so I can make a timelapse video.

    I am on a CentOS 7 machine, running python3.7.0a0.

    python3
    >>> import numpy as np
    >>> np.__version__
    '1.12.0'
    >>> import matplotlib as mpl
    >>> mpl.__version__
    '2.0.0'
    >>> import mpl_toolkits.basemap as base
    >>> base.__version__
    '1.0.7'

    I found this github gist on installing ffmpeg. I used the chromium source, and installed without a prefix option (using the default).

    I have confirmed that ffmpeg is installed, although I don’t know anything about testing whether it works.

    which ffmpeg
    /usr/local/bin/ffmpeg

    ffmpeg -version
    ffmpeg version N-83533-gada281d Copyright (c) 2000-2017 the FFmpeg dev elopers
    built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11
    configuration:
    libavutil      55. 47.100 / 55. 47.100
    libavcodec     57. 80.100 / 57. 80.100
    libavformat    57. 66.102 / 57. 66.102
    libavdevice    57.  2.100 / 57.  2.100
    libavfilter     6. 73.100 /  6. 73.100
    libswscale      4.  3.101 /  4.  3.101
    libswresample   2.  4.100 /  2.  4.100

    I tried to run a few sample examples I found online :

    [1] http://matplotlib.org/examples/animation/basic_example_writer.html

    [2] https://stackoverflow.com/a/23098090/3454650

    Everything works fine up until I try to save the animation file.

    [1]

    anim.save('basic_animation.mp4', writer = FFwriter, fps=30, extra_args=['-vcodec', 'libx264'])

    [2]

    im_ani.save('im.mp4', writer=writer)

    I found here that explictly setting the path to ffmpeg might be necessary so I added this to the top of the test scripts :

    plt.rcParams['animation.ffmpeg_path'] = '/usr/local/bin/ffmpeg'

    I tried a few more tweaks in the code but always get the same response, which I do not know how to begin deciphering :

    Traceback (most recent call last):
     File "testanim.py", line 27, in <module>
       writer.grab_frame()
     File "/usr/local/lib/python3.7/contextlib.py", line 100, in __exit__
       self.gen.throw(type, value, traceback)
     File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 256, in saving
       self.finish()
     File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 276, in finish
       self.cleanup()
     File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 311, in cleanup
       out, err = self._proc.communicate()
     File "/usr/local/lib/python3.7/subprocess.py", line 836, in communicate
       stdout, stderr = self._communicate(input, endtime, timeout)
     File "/usr/local/lib/python3.7/subprocess.py", line 1474, in _communicate
       selector.register(self.stdout, selectors.EVENT_READ)
     File "/usr/local/lib/python3.7/selectors.py", line 351, in register
       key = super().register(fileobj, events, data)
     File "/usr/local/lib/python3.7/selectors.py", line 237, in register
       key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
     File "/usr/local/lib/python3.7/selectors.py", line 224, in _fileobj_lookup
       return _fileobj_to_fd(fileobj)
     File "/usr/local/lib/python3.7/selectors.py", line 39, in _fileobj_to_fd
       "{!r}".format(fileobj)) from None
    ValueError: Invalid file object: &lt;_io.BufferedReader name=6>
    </module>

    Is there something with my configuration that is malformed ? I searched google for this error for some time but never found anything relevant to animations / ffmpeg. Any help would be greatly appreciated.


    UPDATE :

    @LordNeckBeard pointed me here : https://trac.ffmpeg.org/wiki/CompilationGuide/Centos

    I ran into problems with installing the x264 encoding dependency. Some files in libavcodec/*.c (in the make output) were reporting undefined references to several functions. After a wild goose chase found this : https://mailman.videolan.org/pipermail/x264-devel/2015-February/010971.html

    To fix the x264 installation, I simply added some configure flags :

    ./configure --enable-static --enable-shared --extra-ldflags="-lswresample -llzma"

    UPDATE :

    So everything installed fine after fixing the libx264 problems. I went ahead and copied the ffmpeg binary from the ffmpeg_build folder into /usr/local/bin/ffmpeg.

    After running the script I was getting problems where ffmpeg could not find the libx264 shared object. I think I will have to recompile everything using different prefixes. My intuition tells me there are old files laying around after I have messed with everything, using some configuration that is broken.

    So I decided maybe I should just try to use NUX : http://linoxide.com/linux-how-to/install-ffmpeg-centos-7/
    I installed ffmpeg using the new rpm, but to no avail. I still was not able to run ffmpeg because of a missing shared object.

    Finally, instead of usiong files copied into my /usr/local/bin folder, I ran ffmpeg directly from the build bin directory. Turns out that this does work properly !

    So in essence, if I want to install ffmpeg system wide, I need to manually compile from sources again but using a nonlocal prefix.

  • How to decrease the latency of the RTP streaming with ffmpeg in Android ?

    24 août 2018, par Douglas Lima Dantas

    I’m creating a App that do a RTP streaming. It uses a ParcelFileDescriptor pipe pair, where a MediaRecorder writes in the pipe while the ffmpeg receives the audio from the pipe and sends by RTP.

    In my desktop, using the same wifi router, I receive the RTP stream using ffplay, and it has a delay between 5s 10s.

    I tried capture audio using ffmpeg in Android, but itsn’t possible. I tried to use ffplay -fflags nobuffer, use MIC as source, change the encoder, etc.

    I need the lowest delay possible. How can I do it ?

    The code :

    public class MainActivity extends AppCompatActivity implements View.OnClickListener {
       MediaRecorder mediaRecorder;
       AudioRecord record;
       MediaPlayer mediaPlayer;
       ParcelFileDescriptor[] pipePair;
       ParcelFileDescriptor pipeRead;
       ParcelFileDescriptor pipeWrite;
       Process ffmpegProc;
       // Requesting permission to RECORD_AUDIO
       private boolean permissionsAccepted = false;
       private String [] permissions = {
               Manifest.permission.RECORD_AUDIO,
               Manifest.permission.INTERNET,
               Manifest.permission.ACCESS_NETWORK_STATE
       };
       private static final int REQUEST_PERMISSIONS = 200;

       @Override
       public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
           super.onRequestPermissionsResult(requestCode, permissions, grantResults);
           switch (requestCode){
               case REQUEST_PERMISSIONS:
                   permissionsAccepted  = grantResults[0] == PackageManager.PERMISSION_GRANTED;
                   break;
           }
           if (!permissionsAccepted ) finish();

       }

       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main);
           ActivityCompat.requestPermissions(this, permissions, REQUEST_PERMISSIONS);

           TextView hello = (TextView) findViewById(R.id.hello);
           hello.setOnClickListener(new View.OnClickListener() {
               @Override
               public void onClick(View view) {
                   Toast.makeText(MainActivity.this, "Clicado",Toast.LENGTH_SHORT)
                           .show();
                   copiarFFMpeg();

               }
           });

       }

       private void executarFFMpeg(final String[] cmd, ParcelFileDescriptor read) {

           try {
               ffmpegProc = Runtime.getRuntime().exec(cmd);
           } catch (IOException e) {
               e.printStackTrace();
           }

           (new Thread(new Runnable() {
               @Override
               public void run() {
                   try {
                       InputStream inStream = ffmpegProc.getInputStream();
                       InputStreamReader sReader = new InputStreamReader(inStream);
                       BufferedReader bufferedReader = new BufferedReader(sReader);
                       String line;
                       while ((line = bufferedReader.readLine()) != null) {
                           Log.d("FFMPEG",line);
                       }
                   } catch (IOException e) {
                       e.printStackTrace();
                   }
               }
           })).start();

           (new Thread(new Runnable() {
               @Override
               public void run() {
                   byte[] buffer = new byte[8192];
                   int read = 0;

                   OutputStream ffmpegInput = ffmpegProc.getOutputStream();
                   FileInputStream reader = new FileInputStream(pipeRead.getFileDescriptor());

                   try {

                       while (true) {

                           if (reader.available()>0) {
                               read = reader.read(buffer);
                               ffmpegInput.write(buffer, 0, read);
                               ffmpegInput.flush();
                           } else {
                               Thread.sleep(10);
                           }

                       }

                   } catch (InterruptedException e) {
                       e.printStackTrace();

                   } catch (IOException e) {
                       e.printStackTrace();

                       onDestroy();
                   }
               }
           })).start();

           Log.d("FFMPEG","Executado");
       }

       private boolean estaExecutando(Process ffmpegProc) {
           if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
               return ffmpegProc.isAlive();
           } else {
               try {
                   ffmpegProc.exitValue();
                   return false;
               } catch (Exception e) {
                   return true;
               }
           }
       }

       private void criarMediaRecorder() {
           if (pipeWrite != null) {
               try {
                   //ffplay.exe -protocol_whitelist rtp,file,udp ..\file.sdp
                   mediaRecorder = new MediaRecorder();
                   mediaRecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
                   mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.AAC_ADTS);
                   mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
                   //mediaRecorder.setAudioChannels(2);
                   mediaRecorder.setOutputFile(pipeWrite.getFileDescriptor());
                   mediaRecorder.prepare();
                   mediaRecorder.start();
                   Log.d("MREC","MediaRecorder criado");
               } catch (Exception e) {
                   e.printStackTrace();
               }
           }
       }

       private void criarPipe() {
           try {
               pipePair =ParcelFileDescriptor.createPipe();
           } catch (IOException e) {
               Log.e("PIPE","Deu zica na criação do pipe");
               e.printStackTrace();
               finish();
           }
           pipeRead = new ParcelFileDescriptor(pipePair[0]);
           pipeWrite  = new ParcelFileDescriptor(pipePair[1]);
       }

       private void copiarFFMpeg() {
           FFmpeg ffmpeg = FFmpeg.getInstance(this);
           try {
               ffmpeg.loadBinary(new LoadBinaryResponseHandler() {

                   @Override
                   public void onStart() {
                       Log.d("FFMPEG","Iniciar cópia");
                   }

                   @Override
                   public void onFailure() {
                       Log.e("FFMPEG","Cópia falhou");
                   }

                   @Override
                   public void onSuccess() {
                       Log.d("FFMPEG","Cópiado com sucesso");

                       criarPipe();
                       //mediaRecorder.start();
                       File ffmpegBin = new File(getFilesDir().getAbsolutePath()+"/ffmpeg");
                       String[] cmd = new String[] {
                               ffmpegBin.getAbsolutePath(),
                               "-re",
                               "-thread_queue_size","4",
                               "-i","pipe:",
                               //"-c:a","libx264",
                               //"-preset","veryfast",
                               //"-tune","zerolatency",
                               "-f",
                               "rtp",
                               "rtp://192.168.0.33:1234"
                       };

                       executarFFMpeg(cmd, pipeRead);

                       criarMediaRecorder();
                   }

                   @Override
                   public void onFinish() {
                   }
               });
           } catch (FFmpegNotSupportedException e) {
               // Handle if FFmpeg is not supported by device
               Log.e("FFMPEG", "Não sou suportado :/");
           }
       }

       @Override
       protected void onDestroy() {
           super.onDestroy();
       }

       @Override
       public void onClick(View view) {

       }
    }

    The command :

    ffplay rtp://192.168.0.33:1234

    ffplay -fflags nobuffer rtp://192.168.0.33:1234