Recherche avancée

Médias (3)

Mot : - Tags -/pdf

Autres articles (39)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

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

  • 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 (6574)

  • 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 - copy the SPECIFED tracks only, ignore all others

    10 janvier 2024, par GDP

    I have some very strange MP4 files that we get regularly for processing created by Wowza. Neither FFMPEG or MEDIAINFO can detect that there are subtitles soft-coded in them, but they ARE there, I can extract them with ccextractor, and when they're played, the captions appear later in the video where the actually start in the timeline.

    


    I've tried every variation of copying with/without re-encoding, but all the answers show how to "omit" the subtitles with -sn such as these :

    


     ffmpeg -i 3078.mp4 -c copy -sn 3078_sn.mp4
 ffmpeg -i 3078.mp4 -c:v libx264 -c:a ac3 -map 0:v:0 -map 0:a:1 3078_sn.mp4
 ffmpeg -i 3078.mp4 -map 0:v:0 -map 0:a:0  -map -0:s -map -0:d  -c copy 3078_sn2.mp4 -y


    


    FFprobe :

    


    ffprobe 3078.mp4 -hide_banner
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001ef2bcd9e00] multiple fourcc not supported
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '3078.mp4':
  Metadata:
    major_brand     : f4v
    minor_version   : 0
    compatible_brands: isommp42m4v
    creation_time   : 2024-01-09T19:59:28.000000Z
  Duration: 02:17:18.47, start: 0.000000, bitrate: 2165 kb/s
  Stream #0:0[0x1](eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 1902 kb/s, 29.96 fps, 29.97 tbr, 90k tbn (default)
    Metadata:
     creation_time   : 2024-01-09T19:59:28.000000Z
     handler_name    : WowzaStreamingEngine
     vendor_id       : [0][0][0][0]
     encoder         : WowzaStreamingEngine
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 257 kb/s (default)
    Metadata:
     creation_time   : 2024-01-09T19:59:28.000000Z
     handler_name    : WowzaStreamingEngine
     vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](eng): Data: none (amf0 / 0x30666D61), 1 kb/s (default)
    Metadata:
     creation_time   : 2024-01-09T19:59:28.000000Z
     handler_name    : WowzaStreamingEngine
Unsupported codec with id 0 for input stream 2


    


    The problem seems to be that FFMPEG isn't detecting they're there, and so copies them anyways. My assumption is that they're not stored in the header of the MP4 properly (or however that's done), so get because they're later detect, but weren't omitted when it checked the header (pure guesswork on that).

    


    So, is there a way to copy ONLY the video, regardless of whatEVER tracks may or not be in the file, then do the same for audio, and then merge the two single-track files ?

    


  • Launching ffmpeg from inside my C code doesn't convert video stream from fifo

    13 mai 2017, par abraxas1

    (Beaglebone Black, ubuntu 16.04 linux 4.4.62-ti-r99)

    I have a raw h264 feed coming into my C program (into a callback from a custom API) and then I named-piped the raw h264 to a file and this CLI command converts that file successfully.

    ffmpeg -report -re -framerate 30 -y -f h264 -i orbi_0148.cam1.h264 -c:v copy -an -video_size 1920x1080 -f mp4 orbi_0148.cam1-1.mp4

    I then try to launch this command from my program with the same options using execv(),

    first mkfifo the fifo’s,

    then launch ffmpeg (shown below) starts the streaming form the cameras to my callback function, and out to the fifos.

    I close the fifos at the end of video recording, and don’t get any file created and get this output, which I don’t understand at all.
    (the successful command line output follows below this output generated from execv())
    thanks, any help much appreciated.
    hardware has come in now and the spot light is on me.

    (execv output with options -report -y -i /tmp/fifocam3.h264 -c:v copy -an -video_size 1920x1080 -f mp4 /media/sd-card/orbi_0140.cam3.mp4)

    root@arm:/home/orbi# cat ffmpeg-20170511-001941.log
    ffmpeg started on 2017-05-11 at 00:19:41
    Report written to "ffmpeg-20170511-001941.log"
    Command line:
    /usr/bin/ffmpeg -report -y -i /tmp/fifocam3.h264 -c:v copy -an -video_size 1920x1080 -f mp4 /media/sd-card/orbi_0140.cam3.mp4
    ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers

     built with gcc 5.4.0 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 20160609
     configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11gr  libavutil      54. 31.100 / 54. 31.100
     libavcodec     56. 60.100 / 56. 60.100
     libavformat    56. 40.101 / 56. 40.101
     libavdevice    56.  4.100 / 56.  4.100
     libavfilter     5. 40.101 /  5. 40.101
     libavresample   2.  1.  0 /  2.  1.  0
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  2.101 /  1.  2.101
     libpostproc    53.  3.100 / 53.  3.100
    Splitting the commandline.
    Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
    Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
    Reading option '-i' ... matched as input url with argument '/tmp/fifocam3.h264'.
    Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
    Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
    Reading option '-video_size' ... matched as AVOption 'video_size' with argument '1920x1080'.
    Reading option '-f' ... matched as option 'f' (force format) with argument 'mp4'.
    Reading option '/media/sd-card/orbi_0140.cam3.mp4' ... matched as output url.
    Finished splitting the commandline.
    Parsing a group of options: global .
    Applying option report (generate a report) with argument 1.
    Applying option y (overwrite output files) with argument 1.

    Successfully parsed a group of options.
    Parsing a group of options: input url /tmp/fifocam3.h264.

    Successfully parsed a group of options.
    Opening an input file: /tmp/fifocam3.h264.
    [h264 @ 0xf249a0] Format h264 probed with size=2048 and score=51
    [h264 @ 0xf249a0] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0
    [h264 @ 0xf25460] Current profile doesn't provide more RBSP data in PPS, skipping
    [h264 @ 0xf25460] bytestream overread -4
    [h264 @ 0xf25460] bytestream overread -4
    [h264 @ 0xf25460] bytestream overread -4
    [h264 @ 0xf25460] bytestream overread -4
    [h264 @ 0xf25460] bytestream overread -10
    [h264 @ 0xf25460] error while decoding MB 112 28, bytestream -10
    [h264 @ 0xf25460] concealing 4737 DC, 4737 AC, 4737 MV errors in P frame
    [h264 @ 0xf25460] Frame num gap 7 5


    /////// successful command line run  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    root@arm:/home/orbi# ffmpeg -report -re -framerate 30 -y -f h264 -i orbi_0148.cam1.h264 -c:v copy -an -video_size 1920x1080 -f mp4 orbi_0148.cam1-1.mp4

    root@arm:/home/orbi# cat ffmpeg-20170511-002629.log
    ffmpeg started on 2017-05-11 at 00:26:29
    Report written to "ffmpeg-20170511-002629.log"
    Command line:
    ffmpeg -report -re -framerate 30 -y -f h264 -i orbi_0148.cam1.h264 -c:v copy -an -video_size 1920x1080 -f mp4 orbi_0148.cam1-1.mp4
    ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 20160609
     configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11gr  libavutil      54. 31.100 / 54. 31.100
     libavcodec     56. 60.100 / 56. 60.100
     libavformat    56. 40.101 / 56. 40.101
     libavdevice    56.  4.100 / 56.  4.100
     libavfilter     5. 40.101 /  5. 40.101
     libavresample   2.  1.  0 /  2.  1.  0
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  2.101 /  1.  2.101
     libpostproc    53.  3.100 / 53.  3.100
    Splitting the commandline.
    Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
    Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.
    Reading option '-framerate' ... matched as AVOption 'framerate' with argument '30'.
    Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
    Reading option '-f' ... matched as option 'f' (force format) with argument 'h264'.
    Reading option '-i' ... matched as input url with argument 'orbi_0148.cam1.h264'.
    Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
    Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
    Reading option '-video_size' ... matched as AVOption 'video_size' with argument '1920x1080'.
    Reading option '-f' ... matched as option 'f' (force format) with argument 'mp4'.
    Reading option 'orbi_0148.cam1-1.mp4' ... matched as output url.
    Finished splitting the commandline.
    Parsing a group of options: global .
    Applying option report (generate a report) with argument 1.
    Applying option y (overwrite output files) with argument 1.

    Successfully parsed a group of options.
    Parsing a group of options: input url orbi_0148.cam1.h264.
    Applying option re (read input at native frame rate) with argument 1.
    Applying option f (force format) with argument h264.

    Successfully parsed a group of options.
    Opening an input file: orbi_0148.cam1.h264.
    [h264 @ 0x848a20] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0
    [h264 @ 0x8515b0] Current profile doesn't provide more RBSP data in PPS, skipping
    [h264 @ 0x8515b0] Current profile doesn't provide more RBSP data in PPS, skipping
    [h264 @ 0x848a20] max_analyze_duration 5000000 reached at 5005000 microseconds st:0
    [h264 @ 0x848a20] After avformat_find_stream_info() pos: 3773440 bytes read:3801088 seeks:0 frames:152
    Input #0, h264, from 'orbi_0148.cam1.h264':
     Duration: N/A, bitrate: N/A
       Stream #0:0, 152, 1/1200000: Video: h264 (Main), yuv420p(tv), 1920x1080, 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc
    Successfully opened the file.
    Parsing a group of options: output url orbi_0148.cam1-1.mp4.

    Applying option c:v (codec name) with argument copy.
    Applying option an (disable audio) with argument 1.
    Applying option f (force format) with argument mp4.
    Successfully parsed a group of options.
    Opening an output file: orbi_0148.cam1-1.mp4.
    Successfully opened the file.
    [mp4 @ 0x8fb230] Codec for stream 0 does not use global headers but container format requires global headers
    Output #0, mp4, to 'orbi_0148.cam1-1.mp4':
     Metadata:
       encoder         : Lavf56.40.101
       Stream #0:0, 0, 1/1200000: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, q=2-31, 29.97 fps, 29.97 tbr, 1200k tbn, 1200k tbc

    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
    Press [q] to stop, [?] for help
    [NULL @ 0x8515b0] Current profile doesn't provide more RBSP data in PPS, skipping    
    No more output streams to write to, finishing.e=00:00:08.64 bitrate=5887.7kbits/s    
    frame=  270 fps= 30 q=-1.0 Lsize=    6443kB time=00:00:08.97 bitrate=5880.6kbits/s    
    video:6440kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.056839%
    Input file #0 (orbi_0148.cam1.h264):
     Input stream #0:0 (video): 270 packets read (6594052 bytes);
     Total: 270 packets (6594052 bytes) demuxed
    Output file #0 (orbi_0148.cam1-1.mp4):
     Output stream #0:0 (video): 270 packets muxed (6594052 bytes);
     Total: 270 packets (6594052 bytes) muxed
    0 frames successfully decoded, 0 decoding errors
    [AVIOContext @ 0x931650] Statistics: 34 seeks, 308 writeouts
    [AVIOContext @ 0x851190] Statistics: 6594052 bytes read, 0 seeks