Recherche avancée

Médias (1)

Mot : - Tags -/epub

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.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (8948)

  • Frames from Video Using OpenCV in Ubuntu with Java 17

    2 août 2023, par bstrdn

    I've been trying to extract frames from a video using OpenCV in an Ubuntu environment with Java 17, but all my attempts have been unsuccessful so far. The main issue is that ffmpeg is not detected by the OpenCV library on ubuntu.

    


    Here's my test code :

    


    Main class

    


    import org.opencv.core.Core;
import org.opencv.videoio.VideoCapture;

public class Main {
  public static String videoPath = "";
  static {
    String osName = System.getProperty("os.name").toLowerCase();
    if (osName.contains("win")) {
      System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
      videoPath = ClassLoader.getSystemResource("video.mp4").getPath();
    } else {
      videoPath = "/video.mp4";
//      System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
      System.load("/usr/lib/opencv_java470.so");
    }
  }

  public static void main(String[] args) throws InterruptedException {
    VideoCapture videoCapture = new VideoCapture(videoPath);
    if (!videoCapture.isOpened()) {
      System.out.println("Error opening video file.");
    } else {
      System.out.println("Everything is fine.");
    }
    System.out.println(Core.getBuildInformation());
    Thread.sleep(1000000000000000000L);
  }
}


    


    Maven :

    


    &lt;?xml version="1.0" encoding="UTF-8"?>&#xA;<project xmlns="http://maven.apache.org/POM/4.0.0">&#xA;  <modelversion>4.0.0</modelversion>&#xA;  <parent>&#xA;    <groupid>org.springframework.boot</groupid>&#xA;    <artifactid>spring-boot-starter-parent</artifactid>&#xA;    <version>3.0.2</version>&#xA;    <relativepath></relativepath> &#xA;  </parent>&#xA;  <groupid>org.example</groupid>&#xA;  <artifactid>untitled</artifactid>&#xA;  <version>1.0-SNAPSHOT</version>&#xA;  <properties>&#xA;    17&#xA;    17&#xA;    UTF-8&#xA;  </properties>&#xA;&#xA;<dependencies>&#xA;<dependency>&#xA;  <groupid>org.bytedeco</groupid>&#xA;  <artifactid>opencv-platform</artifactid>&#xA;  <version>4.7.0-1.5.9</version>&#xA;</dependency>&#xA;&#xA;<dependency>&#xA;  <groupid>org.springframework.boot</groupid>&#xA;  <artifactid>spring-boot-starter-web</artifactid>&#xA;</dependency>&#xA;</dependencies>&#xA;<build>&#xA;<plugins>&#xA;  <plugin>&#xA;    <groupid>org.springframework.boot</groupid>&#xA;    <artifactid>spring-boot-maven-plugin</artifactid>&#xA;  </plugin>&#xA;</plugins>&#xA;</build>&#xA;</project>&#xA;

    &#xA;

    Dockerfile :

    &#xA;

    FROM ubuntu:20.04&#xA;RUN apt-get update &amp;&amp; apt-get install -y openjdk-17-jdk&#xA;RUN apt-get update &amp;&amp; apt-get install -y pkg-config&#xA;RUN apt-get update &amp;&amp; apt-get install -y ffmpeg libavformat-dev libavcodec-dev libswscale-dev libavresample-dev&#xA;ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64&#xA;COPY target/*.jar /app.jar&#xA;COPY src/main/resources/video.mp4 /&#xA;COPY opencv_java470.so /usr/lib&#xA;ENV JAVA_TOOL_OPTIONS="-Djava.library.path=/usr/lib:/lib:/usr/local/lib:/usr/local:/usr/lib/x86_64-linux-gnu"&#xA;ENV LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/usr/local:/usr/lib/x86_64-linux-gnu&#xA;ENTRYPOINT [ "sh", "-c", "java $JAVA_TOOL_OPTIONS -jar /app.jar" ]&#xA;

    &#xA;

    The application displays the following text (video is not opened) :

    &#xA;

    Error opening video file.&#xA;&#xA;2023-08-02T13:30:58.448538297Z &#xA;2023-08-02T13:30:58.448572597Z General configuration for OpenCV 4.7.0 =====================================&#xA;2023-08-02T13:30:58.448587327Z   Version control:               v4.7.0&#xA;2023-08-02T13:30:58.448590607Z &#xA;2023-08-02T13:30:58.448593217Z   Platform:&#xA;2023-08-02T13:30:58.448596057Z     Timestamp:                   2023-03-27T23:13:34Z&#xA;2023-08-02T13:30:58.448598747Z     Host:                        Linux 5.4.0-1103-azure x86_64&#xA;2023-08-02T13:30:58.448601377Z     CMake:                       3.25.2&#xA;2023-08-02T13:30:58.448604277Z     CMake generator:             Unix Makefiles&#xA;2023-08-02T13:30:58.448606837Z     CMake build tool:            /usr/bin/make&#xA;2023-08-02T13:30:58.448609327Z     Configuration:               RELEASE&#xA;2023-08-02T13:30:58.448611867Z &#xA;.......there is a lot of text......&#xA;2023-08-02T13:30:58.448772865Z &#xA;2023-08-02T13:30:58.448775355Z   Video I/O:&#xA;2023-08-02T13:30:58.448777845Z     DC1394:                      NO&#xA;2023-08-02T13:30:58.448780535Z     FFMPEG:                      NO&#xA;2023-08-02T13:30:58.448783105Z       avcodec:                   NO&#xA;2023-08-02T13:30:58.448785725Z       avformat:                  NO&#xA;2023-08-02T13:30:58.448788295Z       avutil:                    NO&#xA;2023-08-02T13:30:58.448790755Z       swscale:                   NO&#xA;2023-08-02T13:30:58.448793295Z       avresample:                NO&#xA;2023-08-02T13:30:58.448795845Z     GStreamer:                   NO&#xA;2023-08-02T13:30:58.448798255Z     v4l/v4l2:                    YES (linux/videodev2.h)&#xA;2023-08-02T13:30:58.448800885Z &#xA;2023-08-02T13:30:58.448803525Z   Parallel framework:            pthreads&#xA;2023-08-02T13:30:58.448806345Z &#xA;............&#xA;2023-08-02T13:30:58.448859654Z   Java:                          export all functions&#xA;2023-08-02T13:30:58.448862024Z     ant:                         /usr/bin/ant (ver 1.10.5)&#xA;2023-08-02T13:30:58.448864504Z     JNI:                         /opt/hostedtoolcache/jdk/8.0.362/x64/include /opt/hostedtoolcache/jdk/8.0.362/x64/include/linux /opt/hostedtoolcache/jdk/8.0.362/x64/include&#xA;2023-08-02T13:30:58.448867224Z     Java wrappers:               YES&#xA;2023-08-02T13:30:58.448869804Z     Java tests:                  NO&#xA;2023-08-02T13:30:58.448872314Z &#xA;2023-08-02T13:30:58.448874734Z   Install to:                    /usr/local&#xA;

    &#xA;

    Moreover, ffmpeg is installed on Ubuntu.

    &#xA;

    How can i fix this ? I'm deathly tired(

    &#xA;

    Thank you in advance for your assistance !

    &#xA;

    First I tried installation following the official instructions.https://github.com/bytedeco/javacv#required-software

    &#xA;

    Then the solution provided in https://stackoverflow.com/a/76750478/8087508,

    &#xA;

    but the result is the same.

    &#xA;

  • Java shelling out to FFMPEG not running nor giving error

    4 janvier, par Todd

    I'm writing a Podcast downloader where I want to be able to download one or more podcasts then run them through FFMPEG.

    &#xA;

    It does run when I run the program in Windows.
    &#xA;It does not run when I run the program in Linux - Meaning FFMPEG may or may not have been called. I have no way of knowing. I get a -1 back from process.waitfor() but no error in my Java logs and no entries at all in the ffmpeg.log file. And there is no file in the processed file directory that FFMPEG would have created.
    &#xA;It does run in Linux if I run the same command that fails in Java from the command line.

    &#xA;

    FFMPEG has the permissions : rwxr-xr-x , so it doesn't seem as if it'd be a permission error. The Java code looks like :

    &#xA;

        ProcessBuilder processBuilder = new ProcessBuilder( commands );&#xA;    processBuilder.redirectErrorStream( true );&#xA;    //  Added the next line to see if I could log an error from ffmpeg&#xA;    processBuilder.redirectOutput( ProcessBuilder.Redirect.appendTo( new File( "./ffmpeg.log" ) ) );&#xA;&#xA;    Process process = processBuilder.start();&#xA;    BufferedReader bufferedOutputReader = new BufferedReader( new InputStreamReader( process.getInputStream() ) );&#xA;    do {&#xA;        outputString = bufferedOutputReader.readLine();&#xA;        if ( outputString != null ) {&#xA;            LOGGER.trace( outputString );&#xA;        }&#xA;    } while ( outputString != null );&#xA;    results = process.waitFor();&#xA;    LOGGER.debug( "Exit value: " &#x2B; results );&#xA;

    &#xA;

    The commands are :

    &#xA;

    2023-10-25 16:21:52,452 224257 [pool-1-thread-4] DEBUG org.sperbolink.utils.CodecUtils - command string: /bin/ffmpeg &#xA;2023-10-25 16:21:52,452 224257 [pool-1-thread-4] DEBUG org.sperbolink.utils.CodecUtils - command string: -y &#xA;2023-10-25 16:21:52,452 224257 [pool-1-thread-4] DEBUG org.sperbolink.utils.CodecUtils - command string: -i &#xA;2023-10-25 16:21:52,452 224257 [pool-1-thread-4] DEBUG org.sperbolink.utils.CodecUtils - command string: "/home/todd/aggregator/incoming/Downrange Radio/Downrange_Radio_2023-02-15_The_Avidity_PD-10_Delivers_.mp3" &#xA;2023-10-25 16:21:52,452 224257 [pool-1-thread-4] DEBUG org.sperbolink.utils.CodecUtils - command string: -ac &#xA;2023-10-25 16:21:52,452 224257 [pool-1-thread-4] DEBUG org.sperbolink.utils.CodecUtils - command string: 1 &#xA;2023-10-25 16:21:52,452 224257 [pool-1-thread-4] DEBUG org.sperbolink.utils.CodecUtils - command string: -af &#xA;2023-10-25 16:21:52,452 224257 [pool-1-thread-4] DEBUG org.sperbolink.utils.CodecUtils - command string: "atempo=1.4,volume=1.4" &#xA;2023-10-25 16:21:52,452 224257 [pool-1-thread-4] DEBUG org.sperbolink.utils.CodecUtils - command string: "/home/todd/aggregator/processed/Downrange Radio/Downrange_Radio_2023-02-15_The_Avidity_PD-10_Delivers_.mp3"&#xA;

    &#xA;

    And the manually constructed and run command line that DOES work is :

    &#xA;

    /bin/ffmpeg -y -i "/home/todd/aggregator/incoming/Downrange Radio/Downrange_Radio_2023-02-15_The_Avidity_PD-10_Delivers_.mp3" -ac 1 -af "atempo=1.4,volume=1.4" "/home/todd/aggregator/processed/Downrange Radio/Downrange_Radio_2023-02-15_The_Avidity_PD-10_Delivers_.mp3"&#xA;

    &#xA;

    The ffmpeg.log file is empty, so I'm doubting whether FFMPEG is ever being reached.

    &#xA;

    What am I doing wrong ?

    &#xA;

    EDIT :&#xA;I changed the commands to be

    &#xA;

    "/bin/ffmpeg 2> foo.txt" &#xA;

    &#xA;

    and the execution code to :

    &#xA;

        ProcessBuilder processBuilder = new ProcessBuilder( commands );&#xA;//        processBuilder.redirectErrorStream( true );&#xA;    //  Added the next line to see if I could log an error from ffmpeg&#xA;//        processBuilder.redirectOutput( ProcessBuilder.Redirect.appendTo( new File( "./ffmpeg.log" ) ) );&#xA;        Process process = processBuilder.start();&#xA;        results = process.waitFor();&#xA;

    &#xA;

    Running that command from the command line displays a list of MMPEG commands that can be run within foo.txt. Upon running from within the Java app, the foo.txt file is empty, so it doesn't appear that FFMPEG ever gets reached. But, I'm clueless why not.

    &#xA;

    EDIT 2 :&#xA;I converted the /bin/ffmpeg path to uppercase to see if that would return an error and it did.

    &#xA;

    ERROR org.mrpc.utilities.ShellUtils - Cannot run program "/BIN/FFMPEG": error=2, No such file or directory&#xA;

    &#xA;

    This seems to confirm that the Java Process object can locate ffmpeg successfully when it is properly cased (i.e. my original code) as I don't see an error message when the case is incorrect. Still not sure why nothing happens when it is called.

    &#xA;

    EDIT 3 :&#xA;I punted on this a year ago, but recently had to revisit. This time I found the answer. It is because I included double quotes around some of the command parameters. That caused the files to not be found. This link states that the Process class handles embedded spaces without any intervention required by you : ProcessBuilder adds extra quotes to command line

    &#xA;

  • FFProbe as .NET Process gives error while command line does not

    13 février 2024, par Ron O

    I've got a sample mp4 (a copy can be found here [sample_tagged.mp4, 562KB]) I've tagged with metadata using FFMpeg. Using a command line, if I issue a general command to view the metadata, I get everything.

    &#xA;

    > ffprobe.exe -hide_banner -loglevel error -show_entries &#x27;format_tags&#x27; sample_tagged.mp4&#xA;[FORMAT]&#xA;TAG:minor_version=512&#xA;TAG:major_brand=isom&#xA;TAG:compatible_brands=isomiso2avc1mp41&#xA;TAG:IMDB=tt0012345&#xA;TAG:Title=Sample MP4&#xA;TAG:synopsis=Watch MP4 sample&#xA;TAG:Rating=3.30&#xA;TAG:TMDB=tv/12345&#xA;TAG:Subtitle=Samples for all!&#xA;TAG:year=2000&#xA;TAG:date=2000:01:01T00:00:00&#xA;TAG:ReleaseDate=2000:01:01&#xA;TAG:genre=Beach;Windy;Sample&#xA;TAG:encoder=Lavf60.3.100&#xA;[/FORMAT]&#xA;

    &#xA;

    Also using the command line, if I limit it to a specific tag, I only get the specific tag as expected.

    &#xA;

    > ffprobe.exe -hide_banner -loglevel error -show_entries &#x27;format_tags=TMDB&#x27; sample_tagged.mp4&#xA;[FORMAT]&#xA;TAG:TMDB=tv/12345&#xA;[/FORMAT]&#xA;

    &#xA;

    I've set up a C# Process (in LINQPad) to mimic this behavior and return the results as a collection of key/value pairs.

    &#xA;

    async Task Main()&#xA;{&#xA;  var sample = await FFProbe.GetProperties("sample_tagged.mp4");&#xA;  sample.Dump("Sample");&#xA;&#xA;  var targeted = await FFProbe.GetProperties("sample_tagged.mp4", "TMDB");&#xA;  targeted.Dump("Sample Targeted");&#xA;}&#xA;&#xA;class FFProbe&#xA;{&#xA;  const string _exeName = @"ffprobe.exe";&#xA;  const string _arguments = @"-hide_banner -loglevel error -show_entries &#x27;format_tags{0}&#x27; ""{1}""";&#xA;&#xA;  static Encoding _Utf8NoBOM = new UTF8Encoding(false);&#xA;&#xA;  public static async Task>> GetProperties(string filename, params string[] targetProperties)&#xA;  {&#xA;    using (var probe = new Process())&#xA;    {&#xA;      var propsRead = new List>();&#xA;&#xA;      probe.EnableRaisingEvents = true;&#xA;      probe.OutputDataReceived &#x2B;= (object sender, DataReceivedEventArgs e) =>&#xA;      {&#xA;        e.Dump("Output");&#xA;        if (e?.Data is null)&#xA;          return;&#xA;        &#xA;        if (e.Data.StartsWith("TAG"))&#xA;        {&#xA;          var eq = e.Data.IndexOf(&#x27;=&#x27;);&#xA;&#xA;          if (eq > 1)&#xA;          {&#xA;            var key = e.Data.Substring(4, eq - 4);&#xA;            var value = e.Data.Substring(eq &#x2B; 1).Trim();&#xA;&#xA;            if (!targetProperties.Any() || targetProperties.Any(tp => key.Equals(tp, StringComparison.InvariantCultureIgnoreCase)))&#xA;            {&#xA;              if (value.Contains("\\r\\n"))&#xA;                value = value.Replace("\\r\\n", Environment.NewLine);&#xA;&#xA;              propsRead.Add(new KeyValuePair(key, value));&#xA;            }&#xA;          }&#xA;        }&#xA;      };&#xA;      probe.ErrorDataReceived &#x2B;= (object sender, DataReceivedEventArgs e) =>&#xA;      {&#xA;        e.Dump("Error");&#xA;        if (e?.Data is null)&#xA;          return;&#xA;      };&#xA;&#xA;      probe.StartInfo.FileName = _exeName;&#xA;      &#xA;      var tagLimiter = string.Empty;&#xA;      &#xA;      if (targetProperties.Any())&#xA;        tagLimiter = $"={string.Join(&#x27;,&#x27;, targetProperties)}";&#xA;      &#xA;      var arguments = string.Format(_arguments, tagLimiter, filename);&#xA;      arguments.Dump();&#xA;&#xA;      probe.StartInfo.Arguments = arguments;&#xA;      probe.StartInfo.UseShellExecute = false;&#xA;      probe.StartInfo.CreateNoWindow = true;&#xA;      probe.StartInfo.RedirectStandardOutput = true;&#xA;      probe.StartInfo.RedirectStandardError = true;&#xA;      probe.StartInfo.StandardOutputEncoding = _Utf8NoBOM;&#xA;      probe.StartInfo.StandardErrorEncoding = _Utf8NoBOM;&#xA;&#xA;      probe.Start();&#xA;      probe.BeginOutputReadLine();&#xA;      probe.BeginErrorReadLine();&#xA;      &#xA;      await probe.WaitForExitAsync();&#xA;&#xA;      return propsRead;&#xA;    }&#xA;  }&#xA;}&#xA;

    &#xA;

    The output for the full sample dump matches the full metadata list. But when getting the targeted tag, I get two error responses.

    &#xA;

    No match for section &#x27;format_tags=TMDB&#x27;&#xA;Failed to set value &#x27;&#x27;format_tags=TMDB&#x27;&#x27; for option &#x27;show_entries&#x27;: Invalid argument&#xA;

    &#xA;

    From the output, the arguments sent into the process match those of the command line above :

    &#xA;

    -hide_banner -loglevel error -show_entries &#x27;format_tags=TMDB&#x27; "sample_tagged.mp4"&#xA;

    &#xA;

    I've copy/pasted the generated arguments to the command line call and it returns the value expected.

    &#xA;

    What am I missing and/or need correction in setting up the call to get the same results via a Process as the command line ?

    &#xA;