Recherche avancée

Médias (91)

Autres articles (94)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (6598)

  • Killing cmd processes in Bravobit FFmpeg

    10 octobre 2018, par kataroty

    I am using Bravobit FFmpeg Bravobit FFmpeg github to convert some audio files. There are more convertion than these 2 but I do not think they are necessary to add here.

    My question is, is it possible to kill or stop these commands once they are started.

    At the moment when I start the first method convertPCMToWav() and then call finish() in the Main method which stops all other processes but these. They just keep on going like nothing has happened.

    public class AudioProcessor {

       private Context context;
       private FFmpeg ffmpeg;

       private File micPcmFile;

       private File pcmtowavTempFile;
       private File mp3towavTempFile;

       public AudioProcessor(Context context, Activity activity) {
           ffmpeg = null;
           ffmpeg = FFmpeg.getInstance(context);
           this.context = context;
           prepare();
       }

       /**
        * Program main method. Starts running program
        * @throws Exception
        */
       public void process() throws Exception {
           if (!ffmpeg.isSupported()) {
               Log.e("AudioProcessor", "FFMPEG not supported! Cannot convert audio!");
               throw new Exception("FFMPeg has to be supported");
           }
           if (!checkIfAllFilesPresent()) {
               Log.e("AudioProcessor", "All files are not set yet. Please set file first");
               throw new Exception("Files are not set!");
           }

           Log.e("AudioProcessor", "Start processing audio");




           Handler handler = new Handler();
           handler.postDelayed(new Runnable() {
               @Override
               public void run() {
                   convertPCMToWav();
               }
           }, 200);
       }

       /**
        * Prepares program
        */
       private void prepare() {
           prepareTempFiles();
       }

       /**
        * Converts PCM to wav file. Automatically create new file.
        */
       private void convertPCMToWav() {
           String[] cmd = { "-f" , "s16le", "-ar", "44.1k", "-i", micPcmFile.toString(), "-y", pcmtowavTempFile.toString()};
           ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {

               @Override
               public void onStart() {
                   super.onStart();
               }

               @Override
               public void onSuccess(String message) {
                   super.onSuccess(message);
                   convertMP3ToWav();
               }
               @Override
               public void onFailure(String message) {
                   super.onFailure(message);
               }
           });
       }

       /**
        * Converts mp3 file to wav file.
        * Creates Wav file
        */
       private void convertMP3ToWav() {
           String[] cmd = { "-i" , backgroundMp3File.toString(), "-y", mp3towavTempFile.toString() };
           ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {
               @Override
               public void onStart() {
                   super.onStart();
               }

               @Override
               public void onSuccess(String message) {
                   super.onSuccess(message);
                   changeMicAudio();
               }
               @Override
               public void onFailure(String message) {
                   super.onFailure(message);

               }
           });
       }

      /**
        * Prepares temp required files by deleteing them if they exsist.
        * Files cannot exists before ffmpeg actions. FFMpeg automatically creates those files.
        */
       private void prepareTempFiles() {
           pcmtowavTempFile = new File(context.getFilesDir()+ Common.TEMP_LOCAL_DIR + "/" + "_pcm.wav");
           mp3towavTempFile = new File(context.getFilesDir()+ Common.TEMP_LOCAL_DIR + "/" + "_mp3.wav");  
           destroyTempFiles();
       }

      /**
        * Destroys temp required files
        */
        private void destroyTempFiles() {

            pcmtowavTempFile.delete();
            mp3towavTempFile.delete();
       }

    }
  • How to deal ffplay bein too slow playing iPhone's videos ?

    21 janvier 2019, par Mikhail T.

    Trying to play a 3840x2160 video recorded by an iPhone 7 (@30fps), I get frequent pauses — in the video, music keeps playing.

    This happens both in firefox and when ffplay is invoked to play the file directly — from command-line. The CPU is a dual E6700 @3.20GHz — not super fast, but it should be able to play smoothly, shouldn’t it ? Video is Intel’s "series 4" integrated chipset — again, not a speed-daemon, but it should be adequate... Support for Intel’s VA API is included.

    I build ffmpeg-4.1 from source using FreeBSD port. As you can see, the port has a maddening amount of options — including several different ones for the 264-codec.

    Any suggestions for improving the decoding speed to the point, where it is watchable by a human ? Thank you !

  • Dynamically created QImage frames to ffmpeg stdin using QThread

    11 mai 2021, par musicamante

    I am trying to create video files with ffmpeg using frames dynamically created on a separate thread.

    


    While I can create those frames and store them on disk/memory, I'd like to avoid that passage since the amount/size of the frames can be high and many "jobs" could be created with different format or options. But, also importantly, I'd like to better understand the logic behind this, as I admit I've not a very deep knowledge on how thread/processing actually works.

    


    Right now I'm trying to create the QProcess in the QThread object, and then run the image creation thread as soon as the process is started, but it doesn't seem to work : no file is created, and I don't even get any output from standard error (but I know I should, since I can get it if I don't use the thread).

    


    Unfortunately, due to my little knowledge on how QProcess deals with threads and piping (and, obviously, all possible ffmpeg options), I really don't understand how can achieve this.

    


    Besides obviously getting the output file created, the expected result is to be able to launch the encoding (and possibly queue more encodings in the meantime) while keeping the UI responding and get notifications of the current processing state.

    


    import re&#xA;from PyQt5 import QtCore, QtGui, QtWidgets&#xA;&#xA;logRegExp = r&#x27;(?:(n:\s&#x2B;)(?P\d&#x2B;)\s).*(?:(pts_time:\s*)(?P<time>\d&#x2B;.\d*))&#x27;&#xA;&#xA;class Encoder(QtCore.QThread):&#xA;    completed = QtCore.pyqtSignal()&#xA;    frameDone = QtCore.pyqtSignal(object)&#xA;    def __init__(self, width=1280, height=720, frameCount=100):&#xA;        super().__init__()&#xA;        self.width = width&#xA;        self.height = height&#xA;        self.frameCount = frameCount&#xA;&#xA;    def start(self):&#xA;        self.currentLog = &#x27;&#x27;&#xA;        self.currentData = bytes()&#xA;        self.process = QtCore.QProcess()&#xA;        self.process.setReadChannel(self.process.StandardError)&#xA;        self.process.finished.connect(self.completed)&#xA;        self.process.readyReadStandardError.connect(self.stderr)&#xA;        self.process.started.connect(super().start)&#xA;        self.process.start(&#x27;ffmpeg&#x27;, [&#xA;            &#x27;-y&#x27;, &#xA;            &#x27;-f&#x27;, &#x27;png_pipe&#x27;, &#xA;            &#x27;-i&#x27;, &#x27;-&#x27;, &#xA;            &#x27;-c:v&#x27;, &#x27;libx264&#x27;, &#xA;            &#x27;-b:v&#x27;, &#x27;800k&#x27;, &#xA;            &#x27;-an&#x27;, &#xA;            &#x27;-vf&#x27;, &#x27;showinfo&#x27;,&#xA;            &#x27;/tmp/test.h264&#x27;, &#xA;        ])&#xA;&#xA;    def stderr(self):&#xA;        self.currentLog &#x2B;= str(self.process.readAllStandardError(), &#x27;utf-8&#x27;)&#xA;        *lines, self.currentLog = self.currentLog.split(&#x27;\n&#x27;)&#xA;        for line in lines:&#xA;            print(&#x27;STDERR: {}&#x27;.format(line))&#xA;            match = re.search(logRegExp, line)&#xA;            if match:&#xA;                data = match.groupdict()&#xA;                self.frameDone.emit(int(data[&#x27;frame&#x27;]))&#xA;&#xA;    def run(self):&#xA;        font = QtGui.QFont()&#xA;        font.setPointSize(80)&#xA;        rect = QtCore.QRect(0, 0, self.width, self.height)&#xA;        for frame in range(1, self.frameCount &#x2B; 1):&#xA;            img = QtGui.QImage(QtCore.QSize(self.width, self.height), QtGui.QImage.Format_ARGB32)&#xA;            img.fill(QtCore.Qt.white)&#xA;            qp = QtGui.QPainter(img)&#xA;            qp.setFont(font)&#xA;            qp.setPen(QtCore.Qt.black)&#xA;            qp.drawText(rect, QtCore.Qt.AlignCenter, &#x27;Frame {}&#x27;.format(frame))&#xA;            qp.end()&#xA;            img.save(self.process, &#x27;PNG&#x27;)&#xA;        print(&#x27;frame creation complete&#x27;)&#xA;&#xA;&#xA;class Test(QtWidgets.QWidget):&#xA;    def __init__(self):&#xA;        super().__init__()&#xA;        layout = QtWidgets.QVBoxLayout(self)&#xA;        self.startButton = QtWidgets.QPushButton(&#x27;Start&#x27;)&#xA;        layout.addWidget(self.startButton)&#xA;&#xA;        self.frameLabel = QtWidgets.QLabel()&#xA;        layout.addWidget(self.frameLabel)&#xA;&#xA;        self.process = Encoder()&#xA;        self.process.completed.connect(lambda: self.startButton.setEnabled(True))&#xA;        self.process.frameDone.connect(self.frameLabel.setNum)&#xA;        self.startButton.clicked.connect(self.create)&#xA;&#xA;    def create(self):&#xA;        self.startButton.setEnabled(False)&#xA;        self.process.start()&#xA;&#xA;&#xA;import sys&#xA;app = QtWidgets.QApplication(sys.argv)&#xA;test = Test()&#xA;test.show()&#xA;sys.exit(app.exec_())&#xA;</time>

    &#xA;

    If I add the following lines at the end of run(), then the file is actually created and I get the stderr output, but I can see that it's processed after the completion of the for cycle, which obviously is not the expected result :

    &#xA;

        self.process.closeWriteChannel()&#xA;    self.process.waitForFinished()&#xA;    self.process.terminate()&#xA;

    &#xA;

    Bonus : I'm on Linux, I don't know if it works differently on Windows (and I suppose it would work similarly on MacOS), but in any case I'd like to know if there are differences and how to possibly deal with them.

    &#xA;