Recherche avancée

Médias (1)

Mot : - Tags -/belgique

Autres articles (38)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

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

Sur d’autres sites (4233)

  • Merging multiple videos in a template/layout with Python FFMPEG ?

    14 janvier 2021, par J. M. Arnold

    I'm currently trying to edit videos with the Python library of FFMPEG. I'm working with multiple file formats, precisely .mp4, .png and text inputs (.txt). The goal is to embed the different video files within a "layout" - for demonstration purposes I tried to design an example picture :

    


    Example

    


    The output is supposed to be a 1920x1080 .mp4 file with the following Elements :

    


      

    • Element 3 is the video itself (due to it being a mobile phone screen recording, it's about the size displayed there)
    • 


    • Element 1 and 2 are the "boarders", i.e. static pictures (?)
    • 


    • Element 4 represents a regularly changing text - input through the python script (probably be read from a .txt file)
    • 


    • Element 5 portrays a .png, .svg or alike ; in general a "picture" in the broad sense.
    • 


    


    What I'm trying to achieve is to create a sort of template file in which I "just" need to input the different .mp4 and .png files, as well as the text and in the end I'll receive a .mp4 file whereas my Python script functions as the navigator sending the data packages to FFMPEG to process the video itself.

    


    I dug into the FFMPEG library as well as the python-specific repository and wasn't able to find such an option. There were lots of articles explaining the usage of "channel layouts" (though these don't seem to fit my need).

    


    In case anyone wants to try on the same versions :

    


      

    • python --version :
Python 3.7.3
    • 


    • pip show ffmpeg : Version : 1.4 (it's the most recent ; on an off-topic note : It's not obligatory to use FFMPEG, I'd prefer using this library though if it doesn't offer the functionality I'm looking for, I'd highly appreciate if someone suggested something else)
    • 


    


  • Normalizing audio in ffmpeg - how ?

    11 novembre 2020, par Betty Crokker

    I'm creating one of those "Brady Bunch" videos for a choir using a C# application I'm writing that uses ffmpeg for all the heavy lifting, and for the most part it's working great but I'm having trouble getting the audio levels just right.

    


    What I'm doing right now, is first "normalizing" the audio from the individual singers like this :

    


      

    • Extract audio into a WAV file using ffmpeg
    • 


    • Load the WAV file into my application using NAudio
    • 


    • Find the maximum 16-bit value
    • 


    • When I create the merged video, specify a volume for this stream that boosts the maximum value to 32767
    • 


    


    So, for example, if I have 3 streams : stream A's maximum audio is 32767 already, stream B's maximum audio is 32000, and stream C's maximum audio is 16000, then when I merge these videos I will specify

    


    [0:a]volume=1.0,aresample=async=1:first_pts=0[aud0]
[1:a]volume=1.02,aresample=async=1:first_pts=0[aud1]
[2:a]volume=2.05,aresample=async=1:first_pts=0[aud2]
[aud0][aud1][aud2]amix=inputs=3[a]


    


    (I have an additional "volume tweak" that lets me adjust the volume level of individual singers as necessary, but we can ignore that for this question)

    


    I am reading the ffmpeg wiki on Audio Volume Manipulation, and I will implement that next, but I don't know what to do with the output it generates. It looks like I'm going to get mean and max volume levels in dB and while I understand decibels in a "yeah, I learned about those in college 30 years ago" kind of way, I don't know how to use those values to normalize the audio of my input videos.

    


    The problem is, in the ffmpeg output video, the audio level is quite low. If I do the same process of extracting the audio and looking at the WAV file in the merged video that ffmpeg generated, the maximum value is only 4904.

    


    How do I implement an algorithm that automatically sets the output volume to a "reasonable" level ? I realize I can simply add a manual volume filter and have the human set the level, but that's going to be a lot of back & forth of generating the merged video, listening to it, adjusting the level, merging again, etc. I want a way where my application figures out an appropriate output volume (possibly with human adjustment allowed).

    


    EDIT

    


    Asking ffmpeg to determine the mean and max volume of each clip does provide mean and max volume in dB, and I can then use those values to scale each input clip :

    


    [0:a]volume=3.40dB,aresample=async=1:first_pts=0[aud0]
[1:a]volume=3.90dB,aresample=async=1:first_pts=0[aud1]
[2:a]volume=4.40dB,aresample=async=1:first_pts=0[aud2]
[3:a]volume=-0.00dB,aresample=async=1:first_pts=0[aud3]


    


    But my final video is still strangely quiet. For now, I've added a manually-entered volume factor that gets applied at the very end :

    


    [aud0][aud1][aud2]amix=inputs=3[a]
[a]volume=volume=3.00[b]


    


    So my question is, in effect, how do I determine algorithmically what this final volume factor needs to be ?

    


    MORE EDIT

    


    There's something deeper going on here, I just set the volume filter to 100 and the output is only slightly louder. Here are my filters, and the relevant portions of the command line :

    


    color=size=1920x1080:c=0x0000FF [base];
[0:v] scale=576x324 [clip0];
[0:a]volume=1.48,aresample=async=1:first_pts=0[aud0];
[1:v] crop=808:1022:202:276,scale=384x486 [clip1];
[1:a]volume=1.57,aresample=async=1:first_pts=0[aud1];
[2:v] crop=1160:1010:428:70,scale=558x486 [clip2];
[2:a]volume=1.66,aresample=async=1:first_pts=0[aud2];
[3:v] crop=1326:1080:180:0,scale=576x469 [clip3];
[3:a]volume=1.70,aresample=async=1:first_pts=0[aud3];
[4:a]volume=0.20,aresample=async=1:first_pts=0[aud4];
[5:a]volume=0.73,aresample=async=1:first_pts=0[aud5];
[6:v] crop=1326:1080:276:0,scale=576x469 [clip4];
[6:a]volume=1.51,aresample=async=1:first_pts=0[aud6];
[base][clip0] overlay=shortest=1:x=32:y=158 [tmp0];
[tmp0][clip1] overlay=shortest=1:x=768:y=27 [tmp1];
[tmp1][clip2] overlay=shortest=1:x=1321:y=27 [tmp2];
[tmp2][clip3] overlay=shortest=1:x=32:y=625 [tmp3];
[tmp3][clip4] overlay=shortest=1:x=672:y=625 [tmp4];
[aud0][aud1][aud2][aud3][aud4][aud5][aud6]amix=inputs=7[a];
[a]adelay=delays=200:all=1[b];
[b]volume=volume=100.00[c];
[c]asplit[a1][a2];

ffmpeg -y ....
   -map "[tmp4]" -map "[a1]" -c:v libx264 "D:\voutput.mp4" 
   -map "[a2]" "D:\aoutput.mp3""


    


    When I do this, the audio I want is louder (loud enough to clip and get distorted), but definitely not 100x louder.

    


  • cutting mp4 with codec copy results no audio in browser

    16 novembre 2020, par Luka

    I'm editing a video clip with ffmpeg. The original does not play in Firefox browser by itself. It does normally in Chromium. I do something like :

    


    ffmpeg -ss 00:05:10 -i INPUT.mp4 -c copy OUTPUT.mp4


    


    the resulting clip plays in Firefox but there's no audio. This happens in Firefox (82.0.3), but not in Chromium (86.0.4240.75). In chromium the sound is ok.

    


    If audio is reencoded with

    


    ffmpeg -ss 00:05:10 -i INPUT.mp4 -c:v copy -ab 360kb OUTPUT.mp4


    


    resulting clip is playing ok in Firefox.

    


    Could anyone explain what is happening here and is it possible to cut the mp4 without reencoding audio resulting in a clip that plays in Firefox too ?

    


    Some data :

    


    ffmpeg version 3.4.8-0ubuntu0.2

    


    ffprobe INPUT.mp4 :

    


    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'INPUT.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: iso4avc1isom
    creation_time   : 2020-11-13T18:45:37.000000Z
    com.apple.proapps.clipID: INPUT
    com.blackmagic-design.camera.dateRecorded: 2020:11:13
    com.apple.proapps.cameraName: 0
    com.blackmagic-design.camera.uuid: BDB766E79E646CBB82E3EB986EA1EA-0
  Duration: 02:01:38.00, start: 0.000000, bitrate: 6047 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 5909 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
    Metadata:
      creation_time   : 2020-11-13T18:45:37.000000Z
      handler_name    : ?Apple Alias Data Handler
      encoder         : H264/AVC
      timecode        : 19:45:35:04
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2020-11-13T18:45:37.000000Z
      handler_name    : ?Apple Alias Data Handler
      timecode        : 19:45:35:04
    Stream #0:2(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2020-11-13T18:45:37.000000Z
      handler_name    : ?Apple Alias Data Handler
      timecode        : 19:45:35:04


    


    ffprobe OUTPUT.mp4

    


    


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'OUTPUT.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 01:34:48.02, start: -0.016000, bitrate: 6022 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080, 5889 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 12800 tbn, 25600 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      timecode        : 19:45:35:04
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      handler_name    : TimeCodeHandler
      timecode        : 19:45:35:04


    


    ffprobe the OUTPUT.mp4 that has audio re-encoded and works in Firefox :

    


      Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 01:34:48.04, start: 0.000000, bitrate: 6160 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080, 5889 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 12800 tbn, 25600 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      timecode        : 19:45:35:04
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 265 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      handler_name    : TimeCodeHandler
      timecode        : 19:45:35:04


    


    EDIT :

    


    I'm providing links to original files, but a bit of warning, they are 4-5GB big each :

    


      

    1. original recording from blackmagic switcher/capture/recorder (this does not play in firefox at all, but does in Chromium)
    2. 


    3. cut version made with -codec copy (plays in firefox but no audio. plays in chromium ok)
    4. 


    5. cut version with re-encoded audio (plays ok in both firefox and chromium)
    6.