Recherche avancée

Médias (29)

Mot : - Tags -/Musique

Autres articles (64)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

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

  • Metadata when Remuxing MP3 Audiobooks into Apple-friendly MP4 with FFmpeg

    23 août 2022, par Crissov

    Since there is apparently no way to tell iTunes or iOS that MP3s contain an audiobook (or radioplay) by ID3 tag or file extension, I would like to remux them into MPEG-4 Part 14 containers with an .m4b file extension (without converting, i.e. transcoding or reencoding, the audio stream to AAC) and set the proper media type tag (stik = 2 Audiobook).

    



    $ ffmpeg -hide_banner -y \
         -i "infile.mp3" -codec copy -map 0 \
         "outfile.m4b"


    



    When auto-detecting the intended format from the output filename, FFmpeg (version 4.2.1 at the time of writing) toggles its -f ipod compatibility mode for .m4a and .m4b, which means it will apparently not accept MPEG 1/2 Layer 3 audio within an MP4 container :

    



    


    [ipod @ 00000223bd927e40]
    
 Could not find tag for codec mp3 in stream #0, codec not currently supported in container
    
 Could not write header for output file #0 (incorrect codec parameters ?) : Invalid argument

    


    



    I can override that (or change the file extension afterwards when using "outfile.mp4") :

    



    $ ffmpeg -hide_banner -y \
         -i "infile.mp3" -codec copy -map 0 -f mp4 \
         "outfile.m4b"


    



    The near-zero time required for the conversion and FFprobe assure me that the remuxing was successful :

    



    

    Stream #0:0(und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)


    


    



    Custom ID3v2 tag fields and ones without a known MP4 cognate have been dropped, though. I would like to preserve them !

    



    How do I do that with -map_metadata, if it is possible at all ?

    



    How can I use -metadata to add the necessary tag field (atom : stik) which would mark the file as an audiobook 
– phrased more generally :
    
how do I add a manually specified metadata tag field (e.g. MP4 atom or box) with FFmpeg ?

    



    $ ffmpeg -hide_banner -y \
         -i "infile.mp3" -codec copy -map 0 -f mp4 \
         -metadata:s:a:0 language=deu \
         -metadata stik=2
         "outfile.m4b"


    



    FFmpeg documentation

    



    

      

    • -metadata[:metadata_specifier] key=value (output,per-metadata)
      
 Set a metadata key/value pair.
    • 


    • 


    • -map_metadata[:metadata_spec_out] infile[:metadata_spec_in] (output,per-metadata)
      
 Set metadata information of the next output file from infile. Note that those are file indices (zero-based), not filenames. Optional metadata_spec_in/out parameters specify, which metadata to copy. A metadata specifier can have the following forms :
 

        

      • g
        
 global metadata, i.e. metadata that applies to the whole file
      • 


      • s[:stream_spec]
        
 per-stream metadata. stream_spec is a stream specifier as described in the Stream specifiers chapter. In an input metadata specifier, the first matching stream is copied from. In an output metadata specifier, all matching streams are copied to.
      • 


      • c:chapter_index
        
 per-chapter metadata. chapter_index is the zero-based chapter index.
      • 


      • p:program_index
        
 per-program metadata. program_index is the zero-based program index.
      • 


    • 


    
 


    If metadata specifier is omitted, it defaults to global.

    
 


    By default, global metadata is copied from the first input file, per-stream and per-chapter metadata is copied along with streams/chapters. These default mappings are disabled by creating any mapping of the relevant type. A negative file index can be used to create a dummy mapping that just disables automatic copying.

    


    



    PS

    



      

    • Apple does not seem to formally document stik. MPMediaType is slightly different. Pointers to the contrary would be greatly appreciated.
    • 


    • Ideally, I would like to automatically add all *.mp3 files within a subdirectory sorted alphabetically (which share the same encoder settings) as chapters within a single .mp4 container, but that probably deserves a separate question.
    • 


    


  • Duration of short ogg files (Telegram Voice messages) not correct when loaded into Python

    4 août 2018, par Kromme

    I’m trying to read voice messages, sent by Telegram, using Python but for short voice clips (< 10 seconds), it doesn’t work. It shortens the duration for some reason. It looks like it has something to do with OGG codec, but I’m not really sure.

    See here’s my code, the voice clip is about six seconds, however pydub reads my 6 second voiceclip as 0.06 seconds.

    import telegram
    from pydub import AudioSegment

    AudioSegment.ffmpeg = "./dependencies/ffmpeg-20180802-c9118d4-win64-static/bin/ffmpeg"
    AudioSegment.converter = "./dependencies/ffmpeg-20180802-c9118d4-win64-static/bin/ffmpeg"


    bot = telegram.Bot(token=token)
    f = bot.get_file(file_id)
    f.download('output/voiceclips/{}.ogg'.format(file_id))

    myaudio = AudioSegment.from_ogg("output/voiceclips/{}.ogg".format(file_id))
    print('ID: {}, which is {} seconds'.format(file_id, myaudio.duration_seconds))

    >>> ID: ______, which is 0.06 seconds

    When I open the file in VLC-player, it also states that is has 0 seconds. When I try to convert it to WAV-files using FFmpeg it reads the ogg file as 6 seconds, but writes it as 0.05-second WAV file.

    ffmpeg -i infile.ogg outfile.wav
    ffmpeg version N-91549-gc9118d4d64 Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 7.3.1 (GCC) 20180722
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
     libavutil      56. 18.102 / 56. 18.102
     libavcodec     58. 22.100 / 58. 22.100
     libavformat    58. 17.101 / 58. 17.101
     libavdevice    58.  4.101 / 58.  4.101
     libavfilter     7. 26.100 /  7. 26.100
     libswscale      5.  2.100 /  5.  2.100
     libswresample   3.  2.100 /  3.  2.100
     libpostproc    55.  2.100 / 55.  2.100
    [ogg @ 0000020dd375ad40] 727 bytes of comment header remain
    Input #0, ogg, from 'infile.ogg':
     Duration: 00:00:06.03, start: 0.000000, bitrate: 20 kb/s
       Stream #0:0: Audio: opus, 48000 Hz, mono, fltp
    Stream mapping:
     Stream #0:0 -> #0:0 (opus (native) -> pcm_s16le (native))
    Press [q] to stop, [?] for help
    Output #0, wav, to 'outfile.wav':
     Metadata:
       ISFT            : Lavf58.17.101
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
       Metadata:
         encoder         : Lavc58.22.100 pcm_s16le
    size=       6kB time=00:00:00.05 bitrate= 873.0kbits/s speed=4.12x
    video:0kB audio:6kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.354167%

    For larger files it does the work !

  • Issues with Discord JS Music Bot

    5 décembre 2020, par Thresio

    I am in the process of creating a Discord bot with JS, giving it management, auto role, etc. I just got to the music section of it and I can't quite figure out whats wrong.

    &#xA;&#xA;

    I believe I have installed FFmpeg correctly, as I have access to it from within the terminal. I have also used npm to bring ytdl-core and opusscript into my program.

    &#xA;&#xA;

    What this should do is make the bot join the chat, then play the Youtube link. Currently, I am not error checking the second argument as I just wanted to get it working initially. I have implemented several different instances of .toString() and String() however it always gives the same error listed below.

    &#xA;&#xA;

    . The program still throws this error :

    &#xA;&#xA;

    TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object&#xA;TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object&#xA;&#xA;C:\Users\Thresio&#x27;s PC\Desktop\Discord Bot\node_modules\opusscript\build\opusscript_native_wasm.js:8&#xA;var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var&#xA;key;for(key in Module){if(Module.hasOwnProperty(key))&#xA;{moduleOverrides[key]=Module[key]}}Module["arguments"]=&#xA;[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow) {throw&#xA;toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var &#xA;ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var &#xA;ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof &#xA;importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&amp;&amp;typeof &#xA;process.versions==="object"&amp;&amp;typeof &#xA;process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&amp;&amp;!ENVIRONMENT_IS_WEB&amp;&amp;!ENVIRONM&#xA;ENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&amp;&amp;!ENVIRONMENT_IS_NODE&amp;&amp;!ENVIRONMENT_IS_WORKER;var&#xA;scriptDirectory="";function locateFile(path){i&#xA;abort(TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type &#xA;string. Received type object). Build with -s ASSERTIONS=1 for more info. &#xA;

    &#xA;&#xA;

    Here is my code for calling play :

    &#xA;&#xA;

    case &#x27;play&#x27;:&#xA;&#xA;            function play(connection, message){&#xA;                var server = servers[message.guild.id];&#xA;&#xA;                server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter: &#x27;audioonly&#x27;}));&#xA;&#xA;                server.queue.shift();&#xA;&#xA;                server.dispatcher.on(&#x27;end&#x27;, function(){&#xA;                    if(server.queue[0]){&#xA;                        play(connection, message);&#xA;                    }else {&#xA;                        connection.disconnect();&#xA;                    }&#xA;                })&#xA;            }&#xA;&#xA;            if(!args[1]){&#xA;                message.channel.send(&#x27;You need to provide a link!&#x27;);&#xA;                return;&#xA;            }&#xA;&#xA;            if(!message.member.voiceChannel){&#xA;                message.channel.send(&#x27;You must be in a voice channel to play music!&#x27;);&#xA;                return;&#xA;            }&#xA;&#xA;            if(!servers[message.guild.id]) servers[message.guild.id] = {&#xA;                queue: []&#xA;            }&#xA;&#xA;            var server = servers[message.guild.id];&#xA;&#xA;            server.queue.push(args[1]);&#xA;&#xA;            if(!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection){&#xA;                play(connection, message);&#xA;            })&#xA;            break;&#xA;

    &#xA;&#xA;

    If anyone could assist with this, I would be very grateful.

    &#xA;&#xA;

    EDIT : I unfortunately never figured out my main issue, but I have now found code that works (unlike mine :/).&#xA;For anyone else having this issue, I suggest using the code found here.&#xA;Works like a charm !

    &#xA;