Recherche avancée

Médias (91)

Autres articles (63)

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

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (6173)

  • Sound in videos is full of static

    15 octobre 2017, par Shawn Blakesley

    I’m trying to play sound from an FFMpegFrameGrabber by getting the Frame and sending the audio samples to a SourceDataLine. Here’s what I have so far :

    Creating the SourceDataLine :

    int channels = _grabber.getAudioChannels();
    int format = _grabber.getSampleFormat();
    AudioFormat fmt = new AudioFormat(_grabber.getSampleRate(), format, channels, true, true);
    _sourceDataLine=(SourceDataLine)AudioSystem.getLine(new DataLine.Info(SourceDataLine.class, fmt));
    _sourceDataLine.open(fmt);
    _sourceDataLine.start();

    Attempting to play sound (images are handled in the else block) :

    org.bytedeco.javacv.Frame f = _grabber.grabFrame();

    if (f.samples != null && f.samples.length > 0)
    {
       byte[] bytes = new byte[4096];
       for (Buffer buffer : f.samples)
       {
           FloatBuffer floatBuffer = (FloatBuffer) buffer;
           ByteBuffer byteBuffer = ByteBuffer.allocate(floatBuffer.capacity() * 4);
           byteBuffer.asFloatBuffer().put(floatBuffer);
           byteBuffer.rewind();
           byteBuffer.get(bytes);
           _sourceDataLine.write(bytes, 0, bytes.length);
       }
    }

    (Note : I tried a few different versions of this and they all have static. The versions I tried included combining the buffers into one large buffer, only trying to play one sample instead of each channel, and changing the audio format to many different permutations.)

    The problem is the sound is full of static, and almost completely unintelligible. This is my first time doing any audio programming, so I’m sure I’m doing something completely ridiculous.

    I appreciate any help. Thank you.

    EDIT

    In response to Radiodef, I tried a number of AudioFormats, and I couldn’t find one that worked for PCM_FLOAT. I found an example that used this :

    fmt = new AudioFormat(AudioFormat.Encoding.PCM_FLOAT, _grabber.getSampleRate(), format, channels, channels, _grabber.getSampleRate(), true);

    Note : I tried a few different values for the framesize from examples : channels * format / 8, channels * 8 with a hardcoded samplerate of 64, channels * 4 with a hardcoded samplerate of 32, and any combinations of those

    But it give me this exception :

    java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_FLOAT 44100.0 Hz, 8 bit, stereo, 2 bytes/frame,  is supported.
       at javax.sound.sampled.AudioSystem.getLine(Unknown Source)
       at com.enplug.player.video.Video.<init>(Video.java:52) &lt;- where I get the SourceDataLine
       ...
    </init>

    EDIT 2

    Sorry for the delay. I appreciate all the help Radiodef.

    Here is some output from the FFMpegGrabber that is automatically output.

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\Shawn\AppData\Roaming\Enplug Display\Download\Resource\c7cb496d-96ea-4be8-a238-5ffd50955a3e.mp4':
     Metadata:
       major_brand     : qt
       minor_version   : 0
       compatible_brands: qt
       creation_time   : 2014-10-02 07:14:38
     Duration: 00:00:31.13, start: 0.000000, bitrate: 2412 kb/s
       Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 246 kb/s (default)
       Metadata:
         creation_time   : 2014-10-02 07:14:38
         handler_name    : Core Media Data Handler
       Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 2157 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
       Metadata:
         creation_time   : 2014-10-02 07:14:38
         handler_name    : Core Media Data Handler
         encoder         : H.264

    I have two videos I’m testing with, and the first one (which is the one in the example above) has the following :

    Bit rate: 247 kbps
    Channels: 2 (stereo)
    Audio sample rate: 44 kHz

    And the second is :

    Bit rate: 161 kbps
    Channels: 2 (stereo)
    Audio sample rate: 48 kHz

    They’re both mp4s, and I can provide any details about the video itself if needed.

    As for the library, yeah I’m pretty locked into JavaCV. We already have videos running without sound, but we’re now trying to add sound to our program.

    When I run the sample program from your JSR link I get :

    PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
    PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
    PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
    PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
    PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
    PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
    PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
    PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
    PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
    PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
    PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
    PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
    PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
    PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
    PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
    PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
    PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
    PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
    PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
    PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
    PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
    PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
    PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
    PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
    PCM_UNSIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
    PCM_SIGNED unknown sample rate, 8 bit, mono, 1 bytes/frame,
    PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, little-endian
    PCM_SIGNED unknown sample rate, 16 bit, mono, 2 bytes/frame, big-endian
    PCM_UNSIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
    PCM_SIGNED unknown sample rate, 8 bit, stereo, 2 bytes/frame,
    PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, little-endian
    PCM_SIGNED unknown sample rate, 16 bit, stereo, 4 bytes/frame, big-endian
  • Cannot download m3u8 using ffmpeg

    8 avril 2019, par Vũ Tuấn Anh

    I want to download a mp4 from m3u8 link using ffmpeg command.

    ffmpeg -i https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/master.m3u8 -c copy -bsf:a aac_adtstoasc output1.mp4

    But an error occurred when loading first segment

    https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/720/seg-1-v1-a1.ts?v=664e3521
    https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/master.m3u8: Invalid data found when processing input

    Someone helps me to solve my problem. Thanks !

    Full command

    ffmpeg -i https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/master.m3u8 -c copy -bsf:a aac_adtstoasc output2.mp4ffmpeg version 4.1.1-0york1~16.04 Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
     configuration: --prefix=/usr --extra-version='0york1~16.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-nonfree --enable-libfdk-aac --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
     libavutil      56. 22.100 / 56. 22.100
     libavcodec     58. 35.100 / 58. 35.100
     libavformat    58. 20.100 / 58. 20.100
     libavdevice    58.  5.100 / 58.  5.100
     libavfilter     7. 40.101 /  7. 40.101
     libavresample   4.  0.  0 /  4.  0.  0
     libswscale      5.  3.100 /  5.  3.100
     libswresample   3.  3.100 /  3.  3.100
     libpostproc    55.  3.100 / 55.  3.100
    [hls,applehttp @ 0x56551c942500] Opening 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/720.m3u8?v=664e3521' for reading
    [https @ 0x56551cd51280] Opening 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/480.m3u8?v=3f40a361' for reading
    [https @ 0x56551cd51280] Opening 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/360.m3u8?v=aefcb682' for reading
    [https @ 0x56551cd51280] Opening 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/240.m3u8?v=bda86a2a' for reading
    [https @ 0x56551cd51280] Opening 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/144.m3u8?v=431e8038' for reading
    [hls,applehttp @ 0x56551c942500] Opening 'https://kms.sohatv.vn/drm/55ceb3f8-4675-454a-bfc8-96cb04bbae8f.key' for reading
    [hls,applehttp @ 0x56551c942500] Opening 'crypto+https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/720/seg-1-v1-a1.ts?v=664e3521' for reading
    [hls,applehttp @ 0x56551c942500] Error when loading first segment 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/720/seg-1-v1-a1.ts?v=664e3521'
    https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/master.m3u8: Invalid data found when processing input
  • Format ffmpeg command to extract the full klv for an mpg/ts file

    24 décembre 2020, par Andrew Marquez

    I am extracting the KLV data from an mpg file using klvdata and ffmpeg.

    &#xA;&#xA;

    Following the readme, I have downloaded the sample "Day Flight.mpg" video file that contains KLV data. Running the quick start command works (I get the exact same result as the readme example for the first 6 frames.)

    &#xA;&#xA;

    However, for the life of me I don't know how I can extract the KLV data for the entire video file.

    &#xA;&#xA;

    As an experiment, I tried creating the KLV data file from an offset start :

    &#xA;&#xA;

    ffmpeg -ss 5 -i Day\ Flight.mpg -map data-re -codec copy -f data - > out.klv&#xA;

    &#xA;&#xA;

    and when I run it through my code with different start times (5, 25, etc.) I do get different results.

    &#xA;&#xA;

    This (to me) would suggest that the mpg file does contain KLV data throughout, but I can only access 6 frames at a time.

    &#xA;&#xA;

    I would expect to be able to run an ffmpeg command to output the full KLV data. I need help formatting my ffmpeg command to properly provide all the data.

    &#xA;&#xA;

    To replicate, download the "Day Flight.mpg" file from the klvdata project page and run the command I posted above. You will note it is less than a page long. It should be many, many pages long. Thank you for your help !

    &#xA;