Recherche avancée

Médias (1)

Mot : - Tags -/publier

Autres articles (63)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (11003)

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

    


  • Video Live wallpaper android

    12 juillet 2014, par NZT Solution

    I am trying to implement https://github.com/frankandrobot/GLWallpaperVideoDemo but this is 3 year old code. I didn’t find any other tutorial. I am using eclipse on windows 7. I have searched on google and found that NDK-r7 versions and later can also be build on windows without using Cygwin. I have also followed this link How to play video as live wallpaper android ?. I have generated .so files as well but when i try to install this in my device It is getting crashed. I have installed NDK also tried to replace latest FFMpeg libraries but no Luck ! I wonder if someone could help me out of these ? Error java.lang.RuntimeException: Unable to instantiate service frankandrobot.glwallpapervideodemo.com

  • How to stream to NestJS if the data is transmitted through a NATS broker ?

    13 août 2023, par О. Войтенко

    I have an rtsp to mpegts streamer (ffmpeg wrapped in Express for publishing) that streams by publish to a NATS Jetstream.

    


    const options =
     [
         "-rtsp_transport", "tcp",
         "-i", streamUrl,
         '-f', 'mpegts',
         '-pix_fmt', 'yuv420p',
         '-c:v', 'h264',
         '-b:v', '800k',
         '-r', '30',
         '-muxdelay', '0.4',
         '-movflags', 'frag_keyframe+empty_moov',
         '-'
     ];


    


    try {
         const natsConnection = await nats.connect({
             servers: 'ws://127.0.0.1:9222',
             preserveBuffers: true
         })

         conststream = spawn('ffmpeg', options);

         stream.stdout.on('data', (chunk) => {
             console log(chunk);
             natsConnection.publish('stream.1', chunk);
         });

         stream.stdout.on('error', (error) => {
             console.error('FFmpeg error:', error);
         });

         stream.stdout.on('close', (code) => {
             console.log('FFmpeg process closed with code:', code);
         });
     } catch (e) {
         console.error(e);
     }


    


    It's all about the NestJS application signing up for this when the visitor follows the route.
The controller method itself

    


    @get()
   async findOne(
     @Headers() headers,
     @Res() res,
   ) {
     const streamObservable = this.natsService.subscribeStreamEvents('1');

     // Set appropriate headers for video streaming
     res.setHeader('Content-Type', 'video/mp4');
     res.setHeader('Transfer-Encoding', 'chunked');

     res.status(200);

     // Write data chunks directly to the response
     const subscription = streamObservable.subscribe({
       next: (chunk) => {
         console.log('wwww', chunk);
         res.write(chunk);
       },
       error: (error) => {
         console.error('Error streaming video:', error);
       },
       complete: () => {
         res end();
       },
     });

     res.on('close', () => {
       subscription.unsubscribe();
     });
   }


    


    Well, and service service

    


    subscribeToCameraEvents(cameraId: string) {&#xA;     const subject = new Subject<any>();&#xA;&#xA;     this.natsConnection.subscribe(`stream.${cameraId}`, {&#xA;       callback: (err, msg: Msg) => {&#xA;         if (err) {&#xA;           subject.error(err);&#xA;           return;&#xA;         }&#xA;         // console.log(msg.data);&#xA;         subject.next(msg.data);&#xA;       },&#xA;     });&#xA;&#xA;     return subject.asObservable();&#xA;   }&#xA;</any>

    &#xA;

    The data is consoled as a Buffer.

    &#xA;

    trying to play the stream

    &#xA;

    &#xA;&#xA;&#xA;     &#xA;&#xA;&#xA;<video controls="controls" width="640" height="480" style="background: black">&#xA;     <source src="http://localhost:3301/api/streams" type="video/mp4">&#xA;     Your browser does not support the video tag.&#xA;</source></video>&#xA;&#xA;&#xA;

    &#xA;

    the route is true in the source.

    &#xA;

    The problem is that through VLC and ffplay - localhost:3301/api/streams the stream is displayed, and everything works fine, without any additional settings.

    &#xA;

    And here in html does not want.

    &#xA;

    **What am I doing wrong ? **

    &#xA;

    I will be glad to any comments and additional questions.

    &#xA;

    I have tried canvas and jsmpeg (not working too), @Res(passthrough : true) - stream does not work in VLC, ffplay and html (without passthrough stream is working only in VLS and ffplay)

    &#xA;