Recherche avancée

Médias (0)

Mot : - Tags -/clipboard

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (29)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

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

Sur d’autres sites (5324)

  • Anomalie #4562 : Suite #4468 : Unification des CSS pour les boutons et les icônes

    9 octobre 2020, par RastaPopoulos ♥

    Pour SVP/Composer, de ce que je sais pour l’instant, on n’est pas encore prêt à avoir un truc complet, comprenant l’interface pour les lambdas. Car au delà de la structure des plugins et leurs dépendances (utiliser le json, composer), ya toujours que les gens doivent pouvoir chercher/récupérer/mettre à jour sans être admin sys, sans avoir accès au serveur, aux fichiers (sans même savoir comment ça marche l’hébergement), juste en étant admin d’un site et en voulant ajouter une fonctionnalité.

    Or, en attendant d’avoir trouvé la super solution (cf les pistes qu’on avait dessiné lors de la formation composer), ya vraiment un gros bug ergonomique et même fonctionnel, en obligeant les gens à mettre à jour à la version la plus haute, sans leur montrer à la fois les mises à jour sécu/mineure et les mises à jour majeure, et en pouvant choisir à laquelle monter, et aussi en avertissant pour les majeures que c’est dangereux à vérifier (bref cf le ticket sur les mises à jour). Des gens pètent leur site avec ça, alors qu’ils auraient pu rester à une branche plus basse toujours maintenue (et ça oblige à faire des contorsions sur les plugins d’intégration de libs avec plusieurs préfixes donc plugins pour une même lib). Bref ça me semble au contraire plutôt urgent d’améliorer SVP car ça cause du soucis à pas mal de gens (tous ceux qui ne sont pas chez Nursit, et qui n’ont pas la liste des plugins déjà là bloquée, maintenue par d’autres :p )

  • FFMPEG library's some command not working on android

    21 février 2014, par Saurabh Prajapati

    I need following 2 commands to work on android platform. I found many article on this site where they inform these command works fine for them but it is not working at my end

    For Fedding Effect :
    "ffmpeg -i filename1 fade=in:5:8 output.mp4"

    For Concate Video Files :
    "ffmpeg -i concat : filename1|filename2 -codec copy output.mp4"

    Error : App throws error like unknown command "concate" and "fad-in5:8".

    My Goal : I need to concate 2 "mp4" video files on android platform with Fed In/Fed Out effects.

    Following is my code

    public class VideoTest extends Activity

    public static final String LOGTAG = "MJPEG_FFMPEG";
    byte[] previewCallbackBuffer;

    boolean recording = false;
    boolean previewRunning = false;

    File jpegFile;          
    int fileCount = 0;

    FileOutputStream fos;
    BufferedOutputStream bos;
    Button recordButton;

    Camera.Parameters p;

    NumberFormat fileCountFormatter = new DecimalFormat("00000");
    String formattedFileCount;

    ProcessVideo processVideo;

    String[] libraryAssets = {"ffmpeg","ffmpeg.so",
           "libavcodec.so", "libavcodec.so.52", "libavcodec.so.52.99.1",
           "libavcore.so", "libavcore.so.0", "libavcore.so.0.16.0",
           "libavdevice.so", "libavdevice.so.52", "libavdevice.so.52.2.2",
           "libavfilter.so", "libavfilter.so.1", "libavfilter.so.1.69.0",
           "libavformat.so", "libavformat.so.52", "libavformat.so.52.88.0",
           "libavutil.so", "libavutil.so.50", "libavutil.so.50.34.0",
           "libswscale.so", "libswscale.so.0", "libswscale.so.0.12.0"
    };

    @Override
    public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);

       for (int i = 0; i < libraryAssets.length; i++) {
           try {
               InputStream ffmpegInputStream = this.getAssets().open(libraryAssets[i]);
               FileMover fm = new FileMover(ffmpegInputStream,"/data/data/com.mobvcasting.mjpegffmpeg/" + libraryAssets[i]);
               fm.moveIt();
           } catch (IOException e) {
               e.printStackTrace();
           }
       }

       Process process = null;

       try {
           String[] args = {"/system/bin/chmod", "755", "/data/data/com.mobvcasting.mjpegffmpeg/ffmpeg"};
           process = new ProcessBuilder(args).start();        
           try {
               process.waitFor();
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
           process.destroy();

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

       File savePath = new File(Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/");
       savePath.mkdirs();

       requestWindowFeature(Window.FEATURE_NO_TITLE);
       getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

       setContentView(R.layout.main);


       processVideo = new ProcessVideo();
       processVideo.execute();
    }



    @Override
    public void onConfigurationChanged(Configuration conf)
    {
       super.onConfigurationChanged(conf);
    }  


    private class ProcessVideo extends AsyncTask {
       @Override
       protected Void doInBackground(Void... params) {
           Log.d("test", "VideoTest doInBackground Start");
           /*String videofile = Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/splitter.mp4";
           File file = new File(videofile);
           if(file.exists())
               file.delete();
           file=null;*/

           Process ffmpegProcess = null;
           try {

               String filename1 = Environment.getExternalStorageDirectory().getPath()+ "/com.mobvcasting.mjpegffmpeg/test.mp4";
               String filename2 = Environment.getExternalStorageDirectory().getPath()+ "/com.mobvcasting.mjpegffmpeg/splitter.mp4";
               String StartPath = Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/";

               //String[] ffmpegCommand = {"/data/data/com.mobvcasting.mjpegffmpeg/ffmpeg", "-i", "concat:\""+ filename1+"|"+ filename2+"\"", "-codec", "copy", Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/output.mp4"};
               //String[] ffmpegCommand = {"/data/data/com.mobvcasting.mjpegffmpeg/ffmpeg", "-i", filename1, "fade=in:5:8", Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/output.mp4"};

               ffmpegProcess = new ProcessBuilder(ffmpegCommand).redirectErrorStream(true).start();            

               OutputStream ffmpegOutStream = ffmpegProcess.getOutputStream();
               BufferedReader reader = new BufferedReader(new InputStreamReader(ffmpegProcess.getInputStream()));

               String line;

               Log.d("test", "***Starting FFMPEG***");
               while ((line = reader.readLine()) != null)
               {
                   Log.d("test", "***"+line+"***");
               }
               Log.d("test", "***Ending FFMPEG***");


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

           if (ffmpegProcess != null) {
               ffmpegProcess.destroy();        
           }
           Log.d("test", "doInBackground End");
           return null;
       }

        protected void onPostExecute(Void... result) {
            Log.d("test", "onPostExecute");
            Toast toast = Toast.makeText(VideoTest.this, "Done Processing Video", Toast.LENGTH_LONG);
            toast.show();
        }
    }

    Just for your information, I have copy source from following library

    https://github.com/pvskalyan/Android-MJPEG-Video-Capture-FFMPEG?source=c

  • Joining realtime raw PCM streams with ffmpeg and streaming them back out

    15 avril 2024, par Nathan Ladwig

    I am trying to use ffmpeg to join two PCM streams. I have it sorta kinda working but it's not working great.

    


    I am using Python to receive two streams from two computers running Scream Audio Driver ( ttps ://github.com/duncanthrax/scream )

    


    I am taking them in over UDP and writing them to pipes. The pipes are being received by ffmpeg and mixed, it's writing the mixed stream to another pipe. I'm reading that back in Python and sending it to the target receiver.

    


    My ffmpeg command is

    


    ['ffmpeg', 
'-use_wallclock_as_timestamps', 'true', '-f', 's24le', '-ac', '2', '-ar', '48000', '-i', '/tmp/ffmpeg-fifo-1',
'-use_wallclock_as_timestamps', 'true', '-f', 's24le', '-ac', '2', '-ar', '48000', '-i', '/tmp/ffmpeg-fifo-2',
'-filter_complex', '[0]aresample=async=1[a0],[1]aresample=async=1[a1],[a0][a1]amix', '-y',
'-f', 's24le', '-ac', '2', '-ar', '48000', '/tmp/ffmpeg-fifo-in']


    


    My main issue is that it should be reading ffmpeg-fifo-1 and ffmpeg-fifo-2 asynchronously, but it appears to be not. When the buffers get more than 50 frames out of sync with each other ffmpeg hangs and doesn't recover. I would like to fix this.

    


    In this hacky test code the number of frames sent over each stream are counted and empty frames are sent if the count hits 12. This keeps ffmpeg happy.

    


    The code below takes in two 48KHz 24-bit stereo PCM streams with Scream's header, mixes them, applies the same header, and sends them back out.

    


    It works most of the time. Sometimes I'm getting blasted with static, I think this is when only one or two bytes of a frame are making it to ffmpeg, and it loses track.

    


    The header is always 1152 bytes of pcm data with a 5 byte header. It's described in the Scream repo readme

    


    This is my header :

    


    01 18 02 03 00

    


    01 - 48KHz
18 - Sampling Rate (18h=24d, 24bit)
02 - 2 channels
03 00 - WAVEFORMATEXTENSIBLE

    


    import socket
import struct
import threading
import os
import sys
import time
import subprocess
import tempfile
import select

class Sender(threading.Thread):
    def __init__(self):
        super().__init__()
        TEMPDIR = tempfile.gettempdir() + "/"
        self.fifoin = TEMPDIR + "ffmpeg-fifo-in"
        self.start()

    def run(self):
        self.fd = open(self.fifoin, "rb")
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        while True:
            try:
                header = bytes([0x01, 0x18, 0x02, 0x03, 0x00])  # 48khz, 24-bit, stereo
                data = self.fd.read(1152)
                sendbuf = header + data
                self.sock.sendto(sendbuf, ("192.168.3.199", 4010))  # Audio sink
            except Exception as e:
                print("Except")
                print(e)

class Receiver(threading.Thread):
    def __init__(self):
        super().__init__()
        TEMPDIR = tempfile.gettempdir() + "/"
        self.fifo1 = TEMPDIR + "ffmpeg-fifo-1"
        self.fifo2 = TEMPDIR + "ffmpeg-fifo-2"
        self.fifoin = TEMPDIR + "ffmpeg-fifo-in"
        self.fifos = [self.fifo1, self.fifo2]
        try:
            try:
                os.remove(self.fifoin)
            except:
                pass
            os.mkfifo(self.fifoin)
        except:
            pass
        self.start()
        sender=Sender()

    def run(self):
        ffmpeg_command=['ffmpeg', '-use_wallclock_as_timestamps', 'true', '-f', 's24le', '-ac', '2', '-ar', '48000', '-i', self.fifo1,
                                  '-use_wallclock_as_timestamps', 'true', '-f', 's24le', '-ac', '2', '-ar', '48000', '-i', self.fifo2,
                                  '-filter_complex', '[0]aresample=async=1[a0],[1]aresample=async=1[a1],[a0][a1]amix', "-y", '-f', 's24le', '-ac', '2', '-ar', '48000', self.fifoin]
        print(ffmpeg_command)

        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.setsockopt(socket.SOL_SOCKET,socket.SO_RCVBUF,4096)
        sock.bind(("", 16401))

        recvbuf = bytearray(1157)
        framecount = [0,0]
        closed = 1
        while True:
            ready = select.select([sock], [], [], .2)
            if ready[0]:
                recvbuf, addr = sock.recvfrom(1157)
                if closed == 1:
                    for fifo in self.fifos:
                        try:
                            try:
                                os.remove(fifo)
                            except:
                                pass
                            os.mkfifo(fifo)
                        except:
                            pass
                    framecount = [0,0]
                    print("data, starting ffmpeg")
                    ffmpeg = subprocess.Popen (ffmpeg_command, shell=False, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
                    fifo1_fd = os.open(self.fifo1, os.O_RDWR)
                    fifo1_file = os.fdopen(fifo1_fd, 'wb', 0)
                    fifo2_fd = os.open(self.fifo2, os.O_RDWR)
                    fifo2_file = os.fdopen(fifo2_fd, 'wb', 0)
                    closed = 0
                    for i in range(0,6):
                        fifo1_file.write(bytes([0]*1157))
                        fifo2_file.write(bytes([0]*1157))

                if addr[0] == "192.168.3.199":
                    fifo1_file.write(recvbuf[5:])
                    framecount[0] = framecount[0] + 1

                if addr[0] == "192.168.3.119":
                    fifo2_file.write(recvbuf[5:])
                    framecount[1] = framecount[1] + 1

                # Keep buffers roughly in sync while playing
                targetframes=max(framecount)
                if targetframes - framecount[0] > 11:
                    while (targetframes - framecount[0]) > 0:
                        fifo1_file.write(bytes([0]*1157))
                        framecount[0] = framecount[0] + 1

                if targetframes - framecount[1] > 11:
                    while (targetframes - framecount[1]) > 0:
                        fifo2_file.write(bytes([0]*1157))
                        framecount[1] = framecount[1] + 1
            else:
                if closed == 0:
                    ffmpeg.kill()
                    print("No data, killing ffmpeg")
                    fifo1_file.close()
                    fifo2_file.close()
                    closed = 1
receiver=Receiver()

while True:
    time.sleep(50000)


    


    Does anybody have any pointers on how I can make this better ?