Recherche avancée

Médias (33)

Mot : - Tags -/creative commons

Autres articles (30)

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

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

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

  • AVPlayer currentTime not match with the displayed frame after many seeking. (HLS Stream)

    26 août 2022, par D.Bence

    I have a m3u8 file which i want to use with HLS.
link to m3u8 file

    


    My problem is that when i seek many times, the currentTime not match with the displayed frame. I experience that, the more seeking there is more difference. (it's like a constant +offset)

    


    Our use case is very timing sensitive, we need to stop the videos at specific positions. For this we use the following code :

    


    [_player addBoundaryTimeObserverForTimes:times
      queue:dispatch_get_main_queue()
      usingBlock:^{
            weakSelf.player.rate = 0.0;
            // The time is correct here, but the displayed frame is not sync with this time
            CMTimeShow(weakSelf.player.currentTime);
      }
]   


    


    I read that AVURLAssetPreferPreciseDurationAndTimingKey can help, but the currentTime still wrong.

    


    NSDictionary<nsstring> *options = @{AVURLAssetPreferPreciseDurationAndTimingKey:@YES};&#xA;AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:url options:options];&#xA;AVPlayerItem *item = [AVPlayerItem playerItemWithAsset:urlAsset];&#xA;</nsstring>

    &#xA;

    I also read that there is a problem with the m3u8 itself. (for example wrong GOP size.)

    &#xA;

    What is the reason for the incorrect currentTime, and how can i fix this ?

    &#xA;

    ffprobe m3u8 :

    &#xA;

    ffprobe https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.m3u8&#xA;ffprobe version 5.1 Copyright (c) 2007-2022 the FFmpeg developers&#xA;  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)&#xA;  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon&#xA;  libavutil      57. 28.100 / 57. 28.100&#xA;  libavcodec     59. 37.100 / 59. 37.100&#xA;  libavformat    59. 27.100 / 59. 27.100&#xA;  libavdevice    59.  7.100 / 59.  7.100&#xA;  libavfilter     8. 44.100 /  8. 44.100&#xA;  libswscale      6.  7.100 /  6.  7.100&#xA;  libswresample   4.  7.100 /  4.  7.100&#xA;  libpostproc    56.  6.100 / 56.  6.100&#xA;[hls @ 0x152f04280] Skip (&#x27;#EXT-X-VERSION:3&#x27;)&#xA;[hls @ 0x152f04280] Skip (&#x27;#EXT-X-INDEPENDENT-SEGMENTS&#x27;)&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_6000000bitrate.m3u8&#x27; for reading&#xA;[hls @ 0x152f04280] Skip (&#x27;#EXT-X-VERSION:3&#x27;)&#xA;[https @ 0x154045000] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_15000000bitrate.m3u8&#x27; for reading&#xA;[hls @ 0x152f04280] Skip (&#x27;#EXT-X-VERSION:3&#x27;)&#xA;[https @ 0x154045000] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1520p_33000000bitrate.m3u8&#x27; for reading&#xA;[hls @ 0x152f04280] Skip (&#x27;#EXT-X-VERSION:3&#x27;)&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_6000000bitrate_00001.ts&#x27; for reading&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_6000000bitrate_00002.ts&#x27; for reading&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_15000000bitrate_00001.ts&#x27; for reading&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1080p_15000000bitrate_00002.ts&#x27; for reading&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1520p_33000000bitrate_00001.ts&#x27; for reading&#xA;[hls @ 0x152f04280] Opening &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized1520p_33000000bitrate_00002.ts&#x27; for reading&#xA;Input #0, hls, from &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/released/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.m3u8&#x27;:&#xA;  Duration: 00:49:43.00, start: 2.033367, bitrate: 0 kb/s&#xA;  Program 0&#xA;    Metadata:&#xA;      variant_bitrate : 8133826&#xA;  Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn&#xA;    Metadata:&#xA;      variant_bitrate : 8133826&#xA;  Program 1&#xA;    Metadata:&#xA;      variant_bitrate : 18870392&#xA;  Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn&#xA;    Metadata:&#xA;      variant_bitrate : 18870392&#xA;  Program 2&#xA;    Metadata:&#xA;      variant_bitrate : 40776144&#xA;  Stream #0:2: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 2704x1520 [SAR 1:1 DAR 169:95], 29.97 fps, 29.97 tbr, 90k tbn&#xA;    Metadata:&#xA;      variant_bitrate : 40776144&#xA;

    &#xA;

    ffprobe original mp4 :

    &#xA;

    ffprobe https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/finalized/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.mp4&#xA;ffprobe version 5.1 Copyright (c) 2007-2022 the FFmpeg developers&#xA;  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)&#xA;  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon&#xA;  libavutil      57. 28.100 / 57. 28.100&#xA;  libavcodec     59. 37.100 / 59. 37.100&#xA;  libavformat    59. 27.100 / 59. 27.100&#xA;  libavdevice    59.  7.100 / 59.  7.100&#xA;  libavfilter     8. 44.100 /  8. 44.100&#xA;  libswscale      6.  7.100 /  6.  7.100&#xA;  libswresample   4.  7.100 /  4.  7.100&#xA;  libpostproc    56.  6.100 / 56.  6.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;https://mrkresz-content-bucket.s3.eu-central-1.amazonaws.com/applicationData/extended-path-videos/4b0046fd-0be7-4a07-bc7c-c1a0069116b1/finalized/50816bc9-6118-4dd1-a90e-fb72652bb06f-final-from-anonymized.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf58.76.100&#xA;  Duration: 00:49:42.81, start: 0.000000, bitrate: 36142 kb/s&#xA;  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 2486x1398, 36138 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)&#xA;    Metadata:&#xA;      handler_name    : VideoHandler&#xA;      vendor_id       : [0][0][0][0]&#xA;

    &#xA;

  • ffmpeg failing to add png mask to video : Requested planes not available

    23 août 2022, par Alexandr Sugak

    I am trying to add png mask to make webm video round (cut off its corners).

    &#xA;

    The command I am using :

    &#xA;

    video="./dist/tmp/19_2.webm"&#xA;mask="./dist/tmp/mask.png"&#xA;output="./dist/tmp/circle.webm"&#xA;&#xA;ffmpeg -report -c:v libvpx-vp9 -i "${video}" -loop 1 -i "${mask}" -filter_complex " \&#xA;[1:v]alphaextract[alf];\&#xA;[0:v][alf]alphamerge" \&#xA;-c:a copy -c:v libvpx-vp9 "${output}"&#xA;

    &#xA;

    The command output :

    &#xA;

    sh ./scripts/video_mask.sh &#xA;ffmpeg started on 2022-08-23 at 17:27:48&#xA;Report written to "ffmpeg-20220823-172748.log"&#xA;Log level: 48&#xA;ffmpeg version 5.1-tessus Copyright (c) 2000-2022 the FFmpeg developers&#xA;  built with Apple clang version 11.0.0 (clang-1100.0.33.17)&#xA;  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay&#xA;  libavutil      57. 28.100 / 57. 28.100&#xA;  libavcodec     59. 37.100 / 59. 37.100&#xA;  libavformat    59. 27.100 / 59. 27.100&#xA;  libavdevice    59.  7.100 / 59.  7.100&#xA;  libavfilter     8. 44.100 /  8. 44.100&#xA;  libswscale      6.  7.100 /  6.  7.100&#xA;  libswresample   4.  7.100 /  4.  7.100&#xA;  libpostproc    56.  6.100 / 56.  6.100&#xA;[libvpx-vp9 @ 0x7fa072f05140] v1.11.0-30-g888bafc78&#xA;    Last message repeated 1 times&#xA;Input #0, matroska,webm, from &#x27;./dist/tmp/19_2.webm&#x27;:&#xA;  Metadata:&#xA;    ENCODER         : Lavf59.27.100&#xA;  Duration: 00:00:02.77, start: -0.007000, bitrate: 308 kb/s&#xA;  Stream #0:0(eng): Video: vp9 (Profile 0), yuva420p(tv, unknown/bt709/iec61966-2-1, progressive), 640x480, SAR 1:1 DAR 4:3, 1k tbr, 1k tbn (default)&#xA;    Metadata:&#xA;      ALPHA_MODE      : 1&#xA;      ENCODER         : Lavc59.37.100 libvpx-vp9&#xA;      DURATION        : 00:00:02.744000000&#xA;  Stream #0:1(eng): Audio: opus, 48000 Hz, mono, fltp (default)&#xA;    Metadata:&#xA;      ENCODER         : Lavc59.37.100 libopus&#xA;      DURATION        : 00:00:02.767000000&#xA;Input #1, png_pipe, from &#x27;./dist/tmp/mask.png&#x27;:&#xA;  Duration: N/A, bitrate: N/A&#xA;  Stream #1:0: Video: png, pal8(pc), 640x480 [SAR 2835:2835 DAR 4:3], 25 fps, 25 tbr, 25 tbn&#xA;[libvpx-vp9 @ 0x7fa082f04880] v1.11.0-30-g888bafc78&#xA;Stream mapping:&#xA;  Stream #0:0 (libvpx-vp9) -> alphamerge&#xA;  Stream #1:0 (png) -> alphaextract:default&#xA;  alphamerge:default -> Stream #0:0 (libvpx-vp9)&#xA;  Stream #0:1 -> #0:1 (copy)&#xA;Press [q] to stop, [?] for help&#xA;[libvpx-vp9 @ 0x7fa082f04880] v1.11.0-30-g888bafc78&#xA;[Parsed_alphaextract_0 @ 0x7fa083906e80] Requested planes not available.&#xA;[Parsed_alphaextract_0 @ 0x7fa083906e80] Failed to configure input pad on Parsed_alphaextract_0&#xA;Error reinitializing filters!&#xA;Failed to inject frame into filter network: Invalid argument&#xA;Error while processing the decoded data for stream #0:0&#xA;Conversion failed!&#xA;

    &#xA;

    I've tried different combination of codecs and pixel formats but I still get the same error. My initial understanding was that ffmpeg fails to find the alpha channel in the input video. By setting -c:v libvpx-vp9 option it looks like ffmpeg correctly picks up yuva420p pixel format but it still gives the same error.

    &#xA;

    What I am doing wrong ?

    &#xA;

    Update : if I remove the alphaextract step as suggested in comments, the ffmpeg starts processing video indefinitely (the video I use to test is only 2 sec long). If I specify the number of frames manually, then the output is generated but the mask does not seem to have any effect :

    &#xA;

    ffmpeg -c:v libvpx-vp9 -i "${video}" -loop 1 -i "${mask}" -filter_complex " \&#xA;[0:v][1:v]alphamerge" \&#xA;-c:a copy -b:v 2000k -vframes 60 "${output}"&#xA;

    &#xA;

     sh ./scripts/video_mask.sh &#xA;ffmpeg version 5.1-tessus Copyright (c) 2000-2022 the FFmpeg developers&#xA;  built with Apple clang version 11.0.0 (clang-1100.0.33.17)&#xA;  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay&#xA;  libavutil      57. 28.100 / 57. 28.100&#xA;  libavcodec     59. 37.100 / 59. 37.100&#xA;  libavformat    59. 27.100 / 59. 27.100&#xA;  libavdevice    59.  7.100 / 59.  7.100&#xA;  libavfilter     8. 44.100 /  8. 44.100&#xA;  libswscale      6.  7.100 /  6.  7.100&#xA;  libswresample   4.  7.100 /  4.  7.100&#xA;  libpostproc    56.  6.100 / 56.  6.100&#xA;[libvpx-vp9 @ 0x7fdd6b005f00] v1.11.0-30-g888bafc78&#xA;    Last message repeated 1 times&#xA;Input #0, matroska,webm, from &#x27;./dist/tmp/19_2.webm&#x27;:&#xA;  Metadata:&#xA;    ENCODER         : Lavf59.27.100&#xA;  Duration: 00:00:02.77, start: -0.007000, bitrate: 308 kb/s&#xA;  Stream #0:0(eng): Video: vp9 (Profile 0), yuva420p(tv, unknown/bt709/iec61966-2-1, progressive), 640x480, SAR 1:1 DAR 4:3, 1k tbr, 1k tbn (default)&#xA;    Metadata:&#xA;      ALPHA_MODE      : 1&#xA;      ENCODER         : Lavc59.37.100 libvpx-vp9&#xA;      DURATION        : 00:00:02.744000000&#xA;  Stream #0:1(eng): Audio: opus, 48000 Hz, mono, fltp (default)&#xA;    Metadata:&#xA;      ENCODER         : Lavc59.37.100 libopus&#xA;      DURATION        : 00:00:02.767000000&#xA;Input #1, png_pipe, from &#x27;./dist/tmp/mask.png&#x27;:&#xA;  Duration: N/A, bitrate: N/A&#xA;  Stream #1:0: Video: png, pal8(pc), 640x480 [SAR 2835:2835 DAR 4:3], 25 fps, 25 tbr, 25 tbn&#xA;File &#x27;./dist/tmp/circle.webm&#x27; already exists. Overwrite? [y/N] y&#xA;[libvpx-vp9 @ 0x7fdd6b007ec0] v1.11.0-30-g888bafc78&#xA;Stream mapping:&#xA;  Stream #0:0 (libvpx-vp9) -> alphamerge&#xA;  Stream #1:0 (png) -> alphamerge&#xA;  alphamerge:default -> Stream #0:0 (libvpx-vp9)&#xA;  Stream #0:1 -> #0:1 (copy)&#xA;Press [q] to stop, [?] for help&#xA;[libvpx-vp9 @ 0x7fdd6b007ec0] v1.11.0-30-g888bafc78&#xA;[libvpx-vp9 @ 0x7fdd6b024580] v1.11.0-30-g888bafc78&#xA;Output #0, webm, to &#x27;./dist/tmp/circle.webm&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf59.27.100&#xA;  Stream #0:0: Video: vp9, yuva420p(tv, unknown/bt709/iec61966-2-1, progressive), 640x480 [SAR 1:1 DAR 4:3], q=2-31, 2000 kb/s, 1k fps, 1k tbn&#xA;    Metadata:&#xA;      encoder         : Lavc59.37.100 libvpx-vp9&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A&#xA;  Stream #0:1(eng): Audio: opus, 48000 Hz, mono, fltp (default)&#xA;    Metadata:&#xA;      ENCODER         : Lavc59.37.100 libopus&#xA;      DURATION        : 00:00:02.767000000&#xA;frame=   60 fps= 16 q=2.0 Lsize=     285kB time=00:00:01.98 bitrate=1175.5kbits/s speed=0.526x    &#xA;video:270kB audio:11kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.529399%&#xA;

    &#xA;

  • FFMPEG Loudnorm reading JSON data

    9 juillet 2022, par NineCattoRules

    I tried to normalize some audio files using FFMPEG Loudnorm as described here.

    &#xA;

    However, in Python, I don't understand how to read data info from 1st pass.

    &#xA;

    My code :

    &#xA;

    getLoud =  subprocess.Popen(f"ffmpeg -i {file_path} -filter:a loudnorm=print_format=json -f null NULL", shell=True, stdout=subprocess.PIPE).stdout&#xA;getLoud =  getLoud.read().decode()&#xA;# parse json_str:&#xA;jsonstr_loud = json.loads(getLoud)&#xA;

    &#xA;

    This gives me "errorMessage": "Expecting value: line 1 column 1 (char 0)"

    &#xA;

    I tried also this :

    &#xA;

    os.system(f"ffmpeg -i {file_path} -filter:a loudnorm=print_format=json -f null NULL")&#xA;

    &#xA;

    and it outputs :

    &#xA;

    ffmpeg version N-60236-gffb000fff8-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2022 the FFmpeg developers...&#xA;...&#xA;[Parsed_loudnorm_0 @ 0x5921940] &#xA;{&#xA;    "input_i" : "-9.33",&#xA;    "input_tp" : "-0.63",&#xA;    "input_lra" : "0.60",&#xA;    "input_thresh" : "-19.33",&#xA;    "output_i" : "-24.08",&#xA;    "output_tp" : "-15.40",&#xA;    "output_lra" : "0.60",&#xA;    "output_thresh" : "-34.08",&#xA;    "normalization_type" : "dynamic",&#xA;    "target_offset" : "0.08"&#xA;}&#xA;

    &#xA;

    In Python, how can I use those parameters, such as input_i, input_tp etc. that I need for the 2nd pass ?

    &#xA;

    I can't use ffmpeg-normalize because I'm using FFMPEG as a Layer in Lambda.

    &#xA;