Recherche avancée

Médias (29)

Mot : - Tags -/Musique

Autres articles (70)

  • 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

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (9925)

  • FFMpeg cannot start using Process API

    8 juin 2021, par Prophet Lamb

    So I am trying to use FFProbe to retrieve media information using the Process API, I am on Net 5 and wish to stay cross-platform compatible.
Before I started fiddling around I tried FFMpeg Core to retrieve metadata, but it works only on windows, and cannot handle multiline tags, only the last line is parsed.
So I tried to manually pipe the output to my application.
Initially I've used CliWrap to neatly pipe the output to a StringBuilder as I usually do in other repositories.

    


    var output = new StringBuilder();
var args = new[] { "-i", filePath };
var pResult = await Cli.Wrap(GetFFProbeFilePath())
    .WithArguments(args)
    .WithStandardOutputPipe(PipeTarget.ToStringBuilder(output))
    .ExecuteAsync(cancellationToken);


    


      

    • filePath : any media file.
    • 


    • GetFFProbeFilePath() : scrubbs %PATH% for ffmpeg, returns "C :\ProgramData\chocolatey\bin\ffprobe.exe".
    • 


    • cancellationToken : None for test-cases.
    • 


    


    But that did not work. The output always stays empty.
So I ran the following command using non-elevated cmd : C:\\ProgramData\\chocolatey\\bin\\ffprobe.exe -i my/lovely/file.mp3
and the console displays the output fully, with no error.

    


    Naturally it's the fault of CliWrap cause I am perfect ; that's why I replaced it with a plain Process API call :

    


    var output = new StringBuilder();
using (var p = new Process())
{
    p.StartInfo.FileName = "C:\\ProgramData\\chocolatey\\bin\\ffprobe.exe";
    p.StartInfo.Arguments = String.Join(' ', args);
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.RedirectStandardOutput = true;
    p.Start();
    output.Append(await p.StandardOutput.ReadToEndAsync());
    await p.WaitForExitAsync(cancellationToken);
}


    


    Still the output is empty. So instead of using a pipe that I write to the output of a file :

    


    using var p = new Process();
p.StartInfo.FileName = "C:\\ProgramData\\chocolatey\\bin\\ffprobe.exe";
p.StartInfo.Arguments = " -i \"" + filePath + "\" 2> " + "\"C:\\temp\\metadata.log\"";
if (!p.Start())
    throw new Exception();
await p.WaitForExitAsync(cancellationToken);


    


      

    • C:\temp\ : 777
    • 


    


    The temporary file is not created, from that I conclude that the process has not exited successfully. Even though no exception is thrown (I tried piping the errors as well : nothing).

    


    Then I proceed to run this command 20x and wonder why it works in ps & cmd, but not in C# :

    


    C:\ProgramData\chocolatey\bin\ffprobe.exe -i  my/lovely/file.mp3 2> "C:\temp\metadata.log"

    


    Until I ran it using [Win]+[R], and I got a graphic glich and Windows Error Reporting instead of the process completing, the file was not created. After some experimenting I found that the same behaviour for start + the command in cmd.

    


    Why in (insert deity of preference) name is there a difference between [Win]+[R] and cmd, and why does it crash when run from C# ? How do I overcome this weird behaviour, while still being cross-platform compatible ?

    


    This entire affair works just fine in linux by the way.

    


    Edit :
When starting the cmd process manually, FFProbe is called correctly, but I still do not retrieve any data on the output pipeline, since cmd.exe doesn't write anything, and I can't pipe FFProbe.

    


    var output = new StringBuilder();
_ = await Cli.Wrap("cmd.exe")
   .WithArguments("/C ffprobe -i \"my/lovely/file.mp3\" 2> \"C:\\temp\\metadata.log\"") 
   .WithStandardOutputPipe(PipeTarget.ToStringBuilder(output))
   .ExecuteAsync(cancellationToken);


    


    This actually creates the metadata.log file, but no output since I only redirect the output of cmd.exe, not ffprobe.
My current thought is, that I could open a conhost and manually pipe the ffprobe output to the console input by providing the pipeline explicitly in the command arguments which again would not work in linux the same way, that kind of defeats the purpose.

    


  • Video parameters for best web scrolling performance [duplicate]

    22 février 2018, par biven

    There is web application which provides next workflow. User uploads video -> backend(by using ffmpeg) transform this video for smaller size(320x240) -> web browser plays transformed video. Key feature of this application should be excellent scrolling possibility of video by progress bar. I mean that video should be scrolled as smoothly as possible (without any jumps) when user moves progress bar position back and forward.

    I thought that small size of video helps to provide good scrolling possibility. But that’s incorrect. I have 2 different videos, one scrolling perfect(as I want), second has same resolotion(320x240), but it is scrolling with jumps and breaks.

    By ffprobe I compared both videos and I have next results :

    Video 1(good scrolling) :

    libavutil      56.  7.100 / 56.  7.100
     libavcodec     58.  9.100 / 58.  9.100
     libavformat    58.  5.100 / 58.  5.100
     libavdevice    58.  0.101 / 58.  0.101
     libavfilter     7. 11.101 /  7. 11.101
     libswscale      5.  0.101 /  5.  0.101
     libswresample   3.  0.101 /  3.  0.101
     libpostproc    55.  0.100 / 55.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'spacetestSMALL_512kb.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: mp41
       creation_time   : 1970-01-01T00:00:00.000000Z
       title           : small test video - http://www.archive.org/details/alanoakleysmalltestvideo
       encoder         : Lavf51.10.0
       comment         : license:  http://www.copyright.gov/
     Duration: 00:00:48.32, start: 0.000000, bitrate: 555 kb/s
       Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x240, 505 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
       Metadata:
         creation_time   : 1970-01-01T00:00:00.000000Z
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 45 kb/s (default)
       Metadata:
         creation_time   : 1970-01-01T00:00:00.000000Z
         handler_name    : SoundHandler

    Video 2(bad scrolling) :

    libavutil      56.  7.100 / 56.  7.100
     libavcodec     58.  9.100 / 58.  9.100
     libavformat    58.  5.100 / 58.  5.100
     libavdevice    58.  0.101 / 58.  0.101
     libavfilter     7. 11.101 /  7. 11.101
     libswscale      5.  0.101 /  5.  0.101
     libswresample   3.  0.101 /  3.  0.101
     libpostproc    55.  0.100 / 55.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'e10b1c93-5325-4500-ae7c-12ccd0f617bd.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.5.100
     Duration: 00:00:07.96, start: 0.000000, bitrate: 428 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 4:3 DAR 16:9], 391 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 33 kb/s (default)
       Metadata:
         handler_name    : SoundHandler

    What is the key parameter of video which provide possibility for good scrolling in web browser ?

  • Use FFmpeg to crop a video to square format in Android

    22 août 2016, par Cédric Portmann

    I am currently working on an app that is supposed to crop a 16:9 video into a 1:1 video. However I dont get the code working. If possible the software should convert the inputed video as fast as possible. The resolution can vary between 480x480 and 720x720.

    If I could choose the postion of the crop frame it would be perfect.

    The error I get :

    E/FFmpeg: Exception while trying to run: [Ljava.lang.String;@f0c91b8
    java.io.IOException: Error running exec(). Command: [/data/user/0/com.android.grafika/files/ffmpeg, -i /storage/emulated/0/Alphacrypt1.mp4 -vf crop=640:256:0:400 -threads 5 -preset ultrafast -strict -2 /storage/emulated/0/YourCroppedMovie.mp4] Working Directory: null Environment: null
    at java.lang.ProcessManager.exec(ProcessManager.java:215)
    at java.lang.Runtime.exec(Runtime.java:174)
    at java.lang.Runtime.exec(Runtime.java:129)
    at com.github.hiteshsondhi88.libffmpeg.ShellCommand.run(ShellCommand.java:10)
    at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:38)
    at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:10)
    at android.os.AsyncTask$2.call(AsyncTask.java:295)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)
    Caused by: java.io.IOException: No such file or directory
    at java.lang.ProcessManager.exec(Native Method)
    at java.lang.ProcessManager.exec(ProcessManager.java:213)
    at java.lang.Runtime.exec(Runtime.java:174) 
    at java.lang.Runtime.exec(Runtime.java:129) 
    at com.github.hiteshsondhi88.libffmpeg.ShellCommand.run(ShellCommand.java:10) 
    at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:38) 
    at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:10) 
    at android.os.AsyncTask$2.call(AsyncTask.java:295) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
    at java.lang.Thread.run(Thread.java:818) 

    The code I am using :

    final String[] cmd = new String[]{"-i /storage/emulated/0/Alphacrypt1.mp4 -vf crop=640:256:0:400 -threads 5 -preset ultrafast -strict -2 /storage/emulated/0/YourCroppedMovie.mp4"};

       try {
           final FFmpeg ffmpeg = FFmpeg.getInstance(this);
           ffmpeg.execute(cmd, new FFmpegExecuteResponseHandler() {
               @Override
               public void onSuccess(String message) {
                   Toast.makeText(getApplicationContext(), "Successfully converted!",
                           Toast.LENGTH_LONG).show();
               }

               @Override
               public void onProgress(String message) {

               }

               @Override
               public void onFailure(String message) {
                   Toast.makeText(getApplicationContext(), "Fail!"+ message,
                           Toast.LENGTH_LONG).show();
               }

               @Override
               public void onStart() {
                   Toast.makeText(getApplicationContext(), "Started!",
                           Toast.LENGTH_LONG).show();
               }

               @Override
               public void onFinish() {
                   Toast.makeText(getApplicationContext(), "Stopped!",
                           Toast.LENGTH_LONG).show();
               }
           });
       } catch (FFmpegCommandAlreadyRunningException e) {

       }

    Thank you for your help.

    SOLUTION :

    1. I did not add the "Load Binary" part, which is necessary to run the
      FFmpeg library (http://writingminds.github.io/ffmpeg-android-java/).
    2. The command needs to be splitted using .split(" "); as already told by printfmyname
    3. For now I use -vf crop=1080:1080:0:0 to crop the video to a square. (Without messing up the ratio)