Recherche avancée

Médias (91)

Autres articles (24)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

  • Création définitive du canal

    12 mars 2010, par

    Lorsque votre demande est validée, vous pouvez alors procéder à la création proprement dite du canal. Chaque canal est un site à part entière placé sous votre responsabilité. Les administrateurs de la plateforme n’y ont aucun accès.
    A la validation, vous recevez un email vous invitant donc à créer votre canal.
    Pour ce faire il vous suffit de vous rendre à son adresse, dans notre exemple "http://votre_sous_domaine.mediaspip.net".
    A ce moment là un mot de passe vous est demandé, il vous suffit d’y (...)

Sur d’autres sites (3940)

  • FFmpeg - record from stream terminating unexpectedly using kokorin/Jaffree ffmpeg wrapper for Java

    18 avril 2024, par pyrmon

    I am programming a Spring Boot Application using Maven and Java 21. I am trying to record a stream from a url and save it to a mkv file. I intend to do this with kokorin/Jaffree in version 2023.09.10. The recording seems to work ok, however longer videos are terminating unexpectedly. Sometimes after 5 minutes, other times an hour or even longer. Sometimes with Exit Code 0 and sometimes with 1.

    


    I have implemented the recording like this :

    


    @Override
    public void startRecording(RecordingSchedule recordingSchedule) {
        logger.info("Starting recording for schedule with filename {}", recordingSchedule.getFileName());

        String m3uUrl = recordingSchedule.getM3uUrl();
        LocalDateTime endTime = timeUtils.parseStringToLocalDateTime(recordingSchedule.getEndTime());
        LocalDateTime stopTime = endTime.plusSeconds(20);
        String timeToRecord = timeUtils.calculateTimeToRecord(stopTime);
        Path outputPath = Paths.get("/recordings/" + recordingSchedule.getFileName());

        try {
            FFmpeg.atPath()
                  .addInput(UrlInput.fromUrl(m3uUrl))
                  .addArgument("-xerror")
                  .addArguments("-reconnect", "5")
                  .addArguments("-reconnect_streamed", "5")
                  .addArguments("-reconnect_delay_max", "20")
                  .addArguments("-t", timeToRecord)
                  .addArguments("-c", "copy")
                  .addOutput(
                      UrlOutput.toPath(outputPath))
                  .setLogLevel(LogLevel.WARNING)
                  .execute();
            logger.info("Recording complete. Output file: {}", outputPath.toAbsolutePath());
        } catch (Exception e) {
            logger.error("Error recording M3U stream {}: {}", recordingSchedule.getFileName(), e.getMessage());
        }
    }


    


    And I am calling the method like this :
executorConfig.executorService().submit(() -> ffmpegService.startRecording(recording));

    


    Any ideas what I am doing wrong ?
Here are the log lines at the beginning and end of recording of the past two attempts :

    


    2024-04-18T00:54:48.689+02:00  INFO 1 --- [pool-2-thread-1] m.s.r.service.impl.FfmpegServiceImpl     : Starting recording for schedule with filename Example1.mkv
2024-04-18T00:54:48.697+02:00  WARN 1 --- [pool-2-thread-1] c.github.kokorin.jaffree.ffmpeg.FFmpeg   : ProgressListener isn't set, progress won't be reported
2024-04-18T00:54:48.698+02:00  INFO 1 --- [pool-2-thread-1] c.g.k.jaffree.process.ProcessHandler     : Command constructed:
ffmpeg -loglevel level+warning -i http://example.stream.url.com -n -xerror -reconnect 5 -reconnect_streamed 5 -reconnect_delay_max 20 -t 10771 -c copy /recordings/Example1.mkv
2024-04-18T00:54:48.698+02:00  INFO 1 --- [pool-2-thread-1] c.g.k.jaffree.process.ProcessHandler     : Starting process: ffmpeg
2024-04-18T00:54:48.701+02:00  INFO 1 --- [pool-2-thread-1] c.g.k.jaffree.process.ProcessHandler     : Waiting for process to finish
2024-04-18T01:31:02.633+02:00  WARN 1 --- [         StdErr] c.g.k.jaffree.process.BaseStdReader      : [h264 @ 0x559cd22dd940] [warning] Increasing reorder buffer to 2
2024-04-18T01:31:02.633+02:00  INFO 1 --- [pool-2-thread-1] c.g.k.jaffree.process.ProcessHandler     : Process has finished with status: 0
2024-04-18T01:31:02.734+02:00  INFO 1 --- [pool-2-thread-1] m.s.r.service.impl.FfmpegServiceImpl     : Recording complete. Output file: /recordings/Example1.mkv

2024-04-18T03:54:48.678+02:00  INFO 1 --- [pool-2-thread-2] m.s.r.service.impl.FfmpegServiceImpl     : Starting recording for schedule with filename Example2.mkv
2024-04-18T03:54:48.678+02:00  WARN 1 --- [pool-2-thread-2] c.github.kokorin.jaffree.ffmpeg.FFmpeg   : ProgressListener isn't set, progress won't be reported
2024-04-18T03:54:48.678+02:00  INFO 1 --- [pool-2-thread-2] c.g.k.jaffree.process.ProcessHandler     : Command constructed:
ffmpeg -loglevel level+warning -i http://example.stream.url.com/ -n -xerror -reconnect 5 -reconnect_streamed 5 -reconnect_delay_max 20 -t 11431 -c copy /recordings/Example2.mkv
2024-04-18T03:54:48.678+02:00  INFO 1 --- [pool-2-thread-2] c.g.k.jaffree.process.ProcessHandler     : Starting process: ffmpeg
2024-04-18T03:54:48.679+02:00  INFO 1 --- [pool-2-thread-2] c.g.k.jaffree.process.ProcessHandler     : Waiting for process to finish
2024-04-18T04:57:22.256+02:00  WARN 1 --- [         StdErr] c.g.k.jaffree.process.BaseStdReader      : [h264 @ 0x55707ba988c0] [warning] Increasing reorder buffer to 3
2024-04-18T04:58:47.455+02:00 ERROR 1 --- [         StdErr] c.g.k.jaffree.process.BaseStdReader      : [NULL @ 0x55707ba988c0] [error] Picture timing SEI payload too large
2024-04-18T04:58:47.456+02:00 ERROR 1 --- [         StdErr] c.g.k.jaffree.process.BaseStdReader      : [NULL @ 0x55707ba988c0] [error] non-existing PPS 1 referenced
2024-04-18T04:58:47.456+02:00  WARN 1 --- [         StdErr] c.g.k.jaffree.process.BaseStdReader      : [matroska @ 0x55707ba9a380] [warning] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
2024-04-18T04:58:47.456+02:00 ERROR 1 --- [         StdErr] c.g.k.jaffree.process.BaseStdReader      : [matroska @ 0x55707ba9a380] [error] Can't write packet with unknown timestamp
2024-04-18T04:58:47.463+02:00 ERROR 1 --- [         StdErr] c.g.k.jaffree.process.BaseStdReader      : [error] av_interleaved_write_frame(): Invalid argument
2024-04-18T04:58:47.463+02:00  INFO 1 --- [pool-2-thread-2] c.g.k.jaffree.process.ProcessHandler     : Process has finished with status: 1
2024-04-18T04:58:47.564+02:00 ERROR 1 --- [pool-2-thread-2] m.s.r.service.impl.FfmpegServiceImpl     : Error recording M3U stream Example2.mkv: Process execution has ended with non-zero status: 1. Check logs for detailed error message.


    


    They were supposed to run nearly 3 hours and the other one over 3 hours. And with the timestamps you can see that they are not running nearly as long.
Thank you for your help !

    


  • FFmpeg Streaming Video SpringBoot endpoint not show video duration in video players

    7 avril 2024, par lxluxo23

    it turns out that I've been working on a personal project just out of curiosity.
the main function is to stream video by first encoding it through ffmpeg
then playback said video from any other device
call it "plex" very very primitive

    


    although I achieve my goal which is to encode and send the video to the devices that make the request
this video is sent so to speak as a live broadcast.
I can only pause it, no forward or rewind, anyone have any idea what I am doing wrong or if I should take some other approach either in my service or controller ?

    


    I leave fragments of my code

    


    THE CONTROLLER

    


    @RestController&#xA;@RequestMapping("/api")&#xA;@Log4j2&#xA;public class StreamController {&#xA;&#xA;    @Autowired&#xA;    VideoStreamingService videoStreamingService;&#xA;&#xA;    @Autowired&#xA;    VideoService videoService;&#xA;&#xA;&#xA;    @GetMapping("/stream/{videoId}")&#xA;    public ResponseEntity<streamingresponsebody> livestream(@PathVariable Long videoId,@RequestParam(required = false)  String codec) {&#xA;        Video video = videoService.findVideoById(videoId);&#xA;        if (video != null) {&#xA;            Codec codecEnum = Codec.fromString(codec);&#xA;            return ResponseEntity.ok()&#xA;                    .contentType(MediaType.valueOf("video/mp4"))&#xA;                    .body(outputStream -> videoStreamingService.streamVideo(video.getPath(), outputStream,codecEnum));&#xA;        }&#xA;        return ResponseEntity.notFound().build();&#xA;    }&#xA;}&#xA;</streamingresponsebody>

    &#xA;

    THE SERVICE

    &#xA;

    @Service&#xA;public class VideoStreamingService {&#xA;&#xA;    public void streamVideo(String videoPath, OutputStream outputStream, Codec codec) {&#xA;&#xA;        FFmpeg ffmpeg = FFmpeg.atPath()&#xA;                .addArguments("-i", videoPath)&#xA;                .addArguments("-b:v", "5000k")&#xA;                .addArguments("-maxrate", "5000k")&#xA;                .addArguments("-bufsize", "10000k")&#xA;                .addArguments("-c:a", "aac")&#xA;                .addArguments("-b:a", "320k")&#xA;                .addArguments("-movflags", "frag_keyframe&#x2B;empty_moov&#x2B;faststart")&#xA;                .addOutput(PipeOutput.pumpTo(outputStream)&#xA;                        .setFormat("mp4"))&#xA;                .addArgument("-nostdin");&#xA;        if (codec == Codec.AMD) {&#xA;            ffmpeg.addArguments("-profile:v", "high");&#xA;        }&#xA;        ffmpeg.addArguments("-c:v", codec.getFfmpegArgument());&#xA;        ffmpeg.execute();&#xA;    }&#xA;}&#xA;

    &#xA;

    I have some enums to vary the encoding and use hardware acceleration or not.

    &#xA;

    and here is an example from my player&#xA;the endpoint is the following

    &#xA;

    http://localhost:8080/api/stream/2?codec=AMD&#xA;screenshot

    &#xA;

    I'm not sure if there's someone with more knowledge in either FFmpeg or Spring who could help me with this minor issue, I would greatly appreciate it. I've included the URL of the repository in case anyone would like to review it when answering my question

    &#xA;

    repo

    &#xA;

    I tried changing the encoding format.&#xA;I tried copying the metadata from the original video.&#xA;I tried sending a custom header.&#xA;None of this has worked.

    &#xA;

    I would like to achieve what is mentioned in many sites, which is when you load a video from the network, the player shows how much of that video you have in the local "buffer".

    &#xA;

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

    &#xA;

    Here's my test code :

    &#xA;

    Main class

    &#xA;

    import org.opencv.core.Core;&#xA;import org.opencv.videoio.VideoCapture;&#xA;&#xA;public class Main {&#xA;  public static String videoPath = "";&#xA;  static {&#xA;    String osName = System.getProperty("os.name").toLowerCase();&#xA;    if (osName.contains("win")) {&#xA;      System.loadLibrary(Core.NATIVE_LIBRARY_NAME);&#xA;      videoPath = ClassLoader.getSystemResource("video.mp4").getPath();&#xA;    } else {&#xA;      videoPath = "/video.mp4";&#xA;//      System.loadLibrary(Core.NATIVE_LIBRARY_NAME);&#xA;      System.load("/usr/lib/opencv_java470.so");&#xA;    }&#xA;  }&#xA;&#xA;  public static void main(String[] args) throws InterruptedException {&#xA;    VideoCapture videoCapture = new VideoCapture(videoPath);&#xA;    if (!videoCapture.isOpened()) {&#xA;      System.out.println("Error opening video file.");&#xA;    } else {&#xA;      System.out.println("Everything is fine.");&#xA;    }&#xA;    System.out.println(Core.getBuildInformation());&#xA;    Thread.sleep(1000000000000000000L);&#xA;  }&#xA;}&#xA;

    &#xA;

    Maven :

    &#xA;

    &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;