Recherche avancée

Médias (91)

Autres articles (47)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

Sur d’autres sites (6459)

  • Pipe opencv images to ffmpeg using python

    9 décembre 2015, par jlarsch

    How can I pipe openCV images to ffmpeg (running ffmpeg as a subprocess) ?
    (I am using spyder/anaconda)

    I am reading frames from a video file and do some processing on each frame.

    import cv2  
    cap = cv2.VideoCapture(self.avi_path)
    img = cap.read()
    gray = cv2.cvtColor(img[1], cv2.COLOR_BGR2GRAY)
    bgDiv=gray/vidMed #background division

    then, to pipe the processed frame to ffmpeg, I found this command in a related question :

    sys.stdout.write( bgDiv.tostring() )

    next, I am trying to run ffmpeg as a subprocess :

    cmd='ffmpeg.exe -f rawvideo -pix_fmt gray -s 2048x2048 -r 30 -i - -an -f avi -r 30 foo.avi'
    sp.call(cmd,shell=True)

    (this also from the mentioned post)
    However, this fills my IPython console with cryptic hieroglyphs and then crashes it. any advice ?

    ultimately, I would like to pipe out 4 streams and have ffmpeg encode those 4 streams in parallel.

  • Pipe opencv images to ffmpeg using python

    16 avril 2022, par jlarsch

    How can I pipe openCV images to ffmpeg (running ffmpeg as a subprocess) ?
(I am using spyder/anaconda)

    



    I am reading frames from a video file and do some processing on each frame.

    



    import cv2   
cap = cv2.VideoCapture(self.avi_path)
img = cap.read()
gray = cv2.cvtColor(img[1], cv2.COLOR_BGR2GRAY)
bgDiv=gray/vidMed #background division


    



    then, to pipe the processed frame to ffmpeg, I found this command in a related question :

    



    sys.stdout.write( bgDiv.tostring() )


    



    next, I am trying to run ffmpeg as a subprocess :

    



    cmd='ffmpeg.exe -f rawvideo -pix_fmt gray -s 2048x2048 -r 30 -i - -an -f avi -r 30 foo.avi'
sp.call(cmd,shell=True)


    



    (this also from the mentioned post)
However, this fills my IPython console with cryptic hieroglyphs and then crashes it. any advice ?

    



    ultimately, I would like to pipe out 4 streams and have ffmpeg encode those 4 streams in parallel.

    


  • Building and integrating FFmpeg with FFplay enabled for android

    19 avril 2018, par Sunit Ranjan Poddar

    I’ve been trying to build FFmpeg with FFplay enabled for my Android project using guardian project’s https://github.com/guardianproject/android-ffmpeg/tree/61ea21c932d7498b8d330a421425e50e65c805aa on Ubuntu 17.10 without changing anything in any build/configure.sh files except for setting the NDK_BASE path. After successfully compiling the FFmpeg binaries i tested it on Ububtu and both the binaries(FFmpeg and FFplay) ran perfectly. I copied the same binaries in my project’s res/raw folder and used guardian project’s https://github.com/guardianproject/android-ffmpeg-java/blob/master/src/org/ffmpeg/android/FfmpegController.java wrapper class and customized the same for FFplay for only executing the command without output directory as follows -

       public class FfplayController{
       public String mffplayBin;
       private final static String TAG = "ffplay";
       private File mFileTemp;
       private String mCmdCat = "sh cat";

       public FfplayController(Context context, File fileTemp, boolean overwrite) throws FileNotFoundException, IOException {
           mFileTemp = fileTemp;
           installBinaries(context, overwrite);
       }

       public FfplayController(Context context, File fileTemp) throws FileNotFoundException, IOException {
           mFileTemp = fileTemp;
           installBinaries(context, false);
       }
       public void installBinaries(Context context, boolean overwrite) {
           mffplayBin = installBinary(context, R.raw.ffplay, "ffplay", overwrite);
       }

       public String getBinaryPath() {
           return mffplayBin;
       }

       private static String installBinary(Context ctx, int resId, String filename, boolean upgrade) {
           try {
               File f = new File(ctx.getDir("bin", 0), filename);
               if (upgrade) {
                   if (f.exists()) {
                       f.delete();
                   }
                   copyRawFile(ctx, resId, f, "0755");
               }
               return f.getCanonicalPath();
           } catch (Exception e) {
           Log.e(TAG, "installBinary failed: " + e.getLocalizedMessage());
           return null;
       }
    }

    /**
    * Copies a raw resource file, given its ID to the given location
    *
    * @param ctx   context
    * @param resid resource id
    * @param file  destination file
    * @param mode  file permissions (E.g.: "755")
    * @throws IOException          on error
    * @throws InterruptedException when interrupted
    */
    private static void copyRawFile(Context ctx, int resid, File file, String mode) throws IOException, InterruptedException {
       final String abspath = file.getAbsolutePath();
       // Write the iptables binary
       final FileOutputStream out = new FileOutputStream(file);
       final InputStream is = ctx.getResources().openRawResource(resid);
       byte buf[] = new byte[1024];
       int len;
       while ((len = is.read(buf)) > 0) {
           out.write(buf, 0, len);
       }
       out.close();
       is.close();
       // Change the permissions
       Runtime.getRuntime().exec("chmod " + mode + " " + abspath).waitFor();
    }


    public void execffplay(List<string> cmd, ShellCallback sc, File fileExec) throws IOException, InterruptedException {

       enablePermissions();

       execProcess(cmd, sc, fileExec);
    }

    private void enablePermissions() throws IOException {
       Runtime.getRuntime().exec("chmod 755 " + mffplayBin);

    }

    public void execffplay(List<string> cmd, ShellCallback sc) throws IOException, InterruptedException {
       execffplay(cmd, sc, new File(mffplayBin).getParentFile());
    }

    private int execProcess(List<string> cmds, ShellCallback sc, File fileExec) throws IOException, InterruptedException {

       //ensure that the arguments are in the correct Locale format
       for (String cmd : cmds) {
           cmd = String.format(Locale.US, "%s", cmd);
       }

       ProcessBuilder pb = new ProcessBuilder(cmds);
       pb.directory(fileExec);

       StringBuffer cmdlog = new StringBuffer();

       for (String cmd : cmds) {
           cmdlog.append(cmd);
           cmdlog.append(' ');
       }

       sc.shellOut(cmdlog.toString());

       //pb.redirectErrorStream(true);

       Process process = pb.start();


       // any error message?
       StreamGobbler errorGobbler = new StreamGobbler(
               process.getErrorStream(), "ERROR", sc);

       // any output?
       StreamGobbler outputGobbler = new
               StreamGobbler(process.getInputStream(), "OUTPUT", sc);

       errorGobbler.start();
       outputGobbler.start();

       int exitVal = process.waitFor();

       sc.processComplete(exitVal);

       return exitVal;

    }
    }
    </string></string></string>

    And i execute it as follows -

       List<string> previewCmd = new ArrayList<string>();
       previewCmd.add(fc.mffplayBin);
       previewCmd.add("-f");
       previewCmd.add("mpegts");
       previewCmd.add("-ast");
       previewCmd.add("1");
       previewCmd.add("-vst");
       previewCmd.add("0");
       previewCmd.add("-ar");
       previewCmd.add("48000");
       previewCmd.add("udp://192.168.1.14:8090");
       previewCmd.add(videoRoot);

       FfplayController fc = new FfplayController (context, new File(videoroot), true);
       fc.execffplay(previewCmd, new ShellUtils.ShellCallback() {
           @Override
           public void shellOut(String shellLine) {
               Log.e("SHELL OUT", shellLine);
           }

           @Override
           public void processComplete(int exitValue) {
               Log.e("SHELL EXIT VAL", String.valueOf(exitValue));
           }
       });
    </string></string>

    where videoroot is the local path of the video i want to play and udp:192.168.1.14:8090 is android device’s local ip for ffplay.

    While execution it throws error

    04-19 09:03:39.201 6615-6615/com.demo.ffplaypreview E/SHELL OUT :
    /data/data/com.demo.ffplaypreview/app_bin/ffplay
    /storage/emulated/0/testPreview.mp4 -f mpegts -ast 1 -vst 0 -ar 48000
    udp ://192.168.1.14:8090
    04-19 09:03:39.251 6615-7248/com.demo.ffplaypreview E/SHELL OUT : /data/data/com.demo.ffplaypreview/app_bin/ffplay[1] : syntax error : ’)’
    unexpected
    04-19 09:03:39.251 6615-6615/com.demo.ffplaypreview E/SHELL EXIT VAL : 1