Recherche avancée

Médias (91)

Autres articles (83)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • 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

Sur d’autres sites (14922)

  • FFmpeg C API WMAV2 AVCodecParserContext not found even though CLI can parse WMAs on MacOS

    3 octobre 2023, par grendell

    I am following the decode_audio.c example from FFmpeg, but I am unable to initialize a parser for AV_CODEC_ID_WMAV2.

    


    Test code :

    


    #include &#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;&#xA;int main() {&#xA;    // codec is found successfully&#xA;    const AVCodec * codec = avcodec_find_decoder(AV_CODEC_ID_WMAV2);&#xA;    if (!codec) {&#xA;        fprintf(stderr, "codec not found\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    // parser is always NULL&#xA;    AVCodecParserContext * parser = av_parser_init(codec->id);&#xA;    if (!parser) {&#xA;        fprintf(stderr, "parser not found\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    av_parser_close(parser);&#xA;    return 0;&#xA;}&#xA;

    &#xA;

    Build commands :

    &#xA;

    clang -c -I/opt/homebrew/Cellar/ffmpeg/6.0_1/include wma2mp3.c -o obj/wma2mp3.o&#xA;clang -L/opt/homebrew/Cellar/ffmpeg/6.0_1/lib -lavcodec obj/wma2mp3.o -o wma2mp3&#xA;

    &#xA;

    I'm surprised by the fact that the FFmpeg CLI can perform this operation on the same machine :

    &#xA;

    % ffmpeg -i test.wma test.mp3&#xA;ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers&#xA;  built with Apple clang version 14.0.3 (clang-1403.0.22.14.1)&#xA;  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.0_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --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-audiotoolbox --enable-neon&#xA;  libavutil      58.  2.100 / 58.  2.100&#xA;  libavcodec     60.  3.100 / 60.  3.100&#xA;  libavformat    60.  3.100 / 60.  3.100&#xA;  libavdevice    60.  1.100 / 60.  1.100&#xA;  libavfilter     9.  3.100 /  9.  3.100&#xA;  libswscale      7.  1.100 /  7.  1.100&#xA;  libswresample   4. 10.100 /  4. 10.100&#xA;  libpostproc    57.  1.100 / 57.  1.100&#xA;Guessed Channel Layout for Input Stream #0.0 : mono&#xA;Input #0, asf, from &#x27;test.wma&#x27;:&#xA;  Metadata:&#xA;    ToolName        : Windows Media Encoding Utility&#xA;    ToolVersion     : 8.00.00.0343&#xA;  Duration: 00:00:00.74, start: 0.000000, bitrate: 80 kb/s&#xA;  Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 1 channels, fltp, 48 kb/s&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (wmav2 (native) -> mp3 (libmp3lame))&#xA;Press [q] to stop, [?] for help&#xA;Output #0, mp3, to &#x27;test.mp3&#x27;:&#xA;  Metadata:&#xA;    ToolName        : Windows Media Encoding Utility&#xA;    ToolVersion     : 8.00.00.0343&#xA;    TSSE            : Lavf60.3.100&#xA;  Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp&#xA;    Metadata:&#xA;      encoder         : Lavc60.3.100 libmp3lame&#xA;[libmp3lame @ 0x130706320] Queue input is backward in timeed=N/A    &#xA;[mp3 @ 0x1307056e0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 15668 >= 14764&#xA;size=       8kB time=00:00:00.97 bitrate=  65.8kbits/s speed= 103x    &#xA;video:0kB audio:8kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.048112%&#xA;

    &#xA;

    I am using an Apple M1 machine running MacOS 13.5.2 (22G91).

    &#xA;

    Is the CLI using a different mechanism than av_parser_parse2 to perform this conversion, and is there a better way to accomplish this via the C API ?

    &#xA;

  • Error audio loading when runing Whisper Open AI model

    9 juin 2024, par John mick

    The problem I'm trying to solve is that I can't run Whisper model for some audio, it says something related to audio decoding.

    &#xA;

    payload.wav: Invalid data found when processing input.&#xA;raise RuntimeError(f"Failed to load audio: {e.stderr.decode()}") from e&#xA;

    &#xA;

    I tried using the micro-machines.wav and it works fine but when i used other audio it gives me an error.

    &#xA;

    import whisper&#xA;&#xA;model = whisper.load_model("base")&#xA;text=model.transcribe(&#x27;micro-machines.wav&#x27;,fp16=False)&#xA;print(text)&#xA;text=model.transcribe(&#x27;payload.wav&#x27;,fp16=False)&#xA;print(text)&#xA;

    &#xA;

    Error I'm getting for payload :

    &#xA;

    d:\...\venv\lib\site-packages\whisper\transcribe.py:79: UserWarning: FP16 is not supported on CPU; using FP32 instead&#xA;  warnings.warn("FP16 is not supported on CPU; using FP32 instead")                                                                                        &#xA;Traceback (most recent call last):&#xA;  File "d:\...\venv\lib\site-packages\whisper\audio.py", line 42, in load_audio&#xA;    ffmpeg.input(file, threads=0)                                                                                    &#xA;  File "d:\...\venv\lib\site-packages\ffmpeg\_run.py", line 325, in run        &#xA;    raise Error(&#x27;ffmpeg&#x27;, out, err)                                                                                  &#xA;ffmpeg._run.Error: ffmpeg error (see stderr output for detail)                                                       &#xA;&#xA;The above exception was the direct cause of the following exception:&#xA;&#xA;Traceback (most recent call last):&#xA;  File "C:\....\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main&#xA;    return _run_code(code, main_globals, None,&#xA;  File "C:\.....\Python\Python39\lib\runpy.py", line 87, in _run_code&#xA;    exec(code, run_globals)&#xA;  File "D:\...\venv\Scripts\whisper.exe\__main__.py", line 7, in <module>&#xA;  File "d:\...\venv\lib\site-packages\whisper\transcribe.py", line 314, in cli&#xA;    result = transcribe(model, audio_path, temperature=temperature, **args)&#xA;  File "d:\...\venv\lib\site-packages\whisper\transcribe.py", line 85, in transcribe&#xA;    mel = log_mel_spectrogram(audio)&#xA;  File "d:\...\venv\lib\site-packages\whisper\audio.py", line 111, in log_mel_spectrogram&#xA;    audio = load_audio(audio)&#xA;  File "d:\...\venv\lib\site-packages\whisper\audio.py", line 47, in load_audio&#xA;    raise RuntimeError(f"Failed to load audio: {e.stderr.decode()}") from e&#xA;RuntimeError: Failed to load audio: ffmpeg version 6.0-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers&#xA;  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enab&#xA;le-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxv&#xA;id --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf &#xA;--enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libo&#xA;pencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enab&#xA;le-librubberband&#xA;  libavutil      58.  2.100 / 58.  2.100&#xA;  libavcodec     60.  3.100 / 60.  3.100&#xA;  libavformat    60.  3.100 / 60.  3.100&#xA;  libavdevice    60.  1.100 / 60.  1.100&#xA;  libavfilter     9.  3.100 /  9.  3.100&#xA;  libswscale      7.  1.100 /  7.  1.100&#xA;  libswresample   4. 10.100 /  4. 10.100&#xA;  libpostproc    57.  1.100 / 57.  1.100&#xA;payload.wav: Invalid data found when processing input&#xA;</module>

    &#xA;

    I tried searching for solutions and I found one which says It appears that the code failed to load the audio file for some reason and even failed to display that error because e.stderr did not contain a valid UTF-8 string

    &#xA;

  • Decode a proprietary H264 network video stream

    10 mars 2023, par al_mukthar

    I have incoming byte streams probably encoded in H264 from a RTSP camera through a websocket in my spring boot application,

    &#xA;

    I need to decode the incoming H264 streams to transmit the video to my frontend clients.&#xA;I have tried using javaCV/FFMpeg but nothing works.

    &#xA;

    Any help would be appreciated

    &#xA;

    this is the part of hex dump received through socket

    &#xA;

    00000000: 01 00 00 00 04 48 32 36 34 00 00 00 24 38 65 34    .....H264...$8e4&#xA;00000010: 32 39 65 37 61 2D 32 66 34 66 2D 34 37 31 61 2D    29e7a-2f4f-471a-&#xA;00000020: 39 61 63 30 2D 66 66 62 38 64 64 37 63 37 64 37    9ac0-ffb8dd7c7d7&#xA;00000030: 32 00 00 00 D4 7B 22 49 73 49 6E 69 74 22 3A 66    2...T{"IsInit":f&#xA;00000040: 61 6C 73 65 2C 22 49 73 41 75 64 69 6F 22 3A 66    alse,"IsAudio":f&#xA;00000050: 61 6C 73 65 2C 22 54 6F 74 61 6C 53 65 63 6F 6E    alse,"TotalSecon&#xA;00000060: 64 73 22 3A 30 2E 30 36 2C 22 46 72 61 6D 65 54    ds":0.06,"FrameT&#xA;00000070: 69 6D 65 22 3A 22 32 30 32 33 2D 30 32 2D 32 33    ime":"2023-02-23&#xA;00000080: 54 30 34 3A 32 31 3A 35 33 2E 35 33 31 5A 22 2C    T04:21:53.531Z",&#xA;00000090: 22 53 65 71 75 65 6E 63 65 49 64 22 3A 31 2C 22    "SequenceId":1,"&#xA;000000a0: 42 61 73 65 44 65 63 6F 64 65 54 69 6D 65 22 3A    BaseDecodeTime":&#xA;000000b0: 32 36 35 38 37 2C 22 4D 65 64 69 61 54 69 6D 65    26587,"MediaTime&#xA;000000c0: 22 3A 32 36 35 38 37 2C 22 49 73 46 72 61 6D 65    ":26587,"IsFrame&#xA;000000d0: 48 69 64 64 65 6E 22 3A 66 61 6C 73 65 2C 22 49    Hidden":false,"I&#xA;000000e0: 73 4B 65 79 46 72 61 6D 65 22 3A 66 61 6C 73 65    sKeyFrame":false&#xA;000000f0: 2C 22 49 64 22 3A 34 34 35 2C 22 47 65 6E 65 72    ,"Id":445,"Gener&#xA;00000100: 61 74 69 6F 6E 22 3A 31 7D 00 00 3F 50 00 00 00    ation":1}..?P...&#xA;00000110: 68 6D 6F 6F 66 00 00 00 10 6D 66 68 64 00 00 00    hmoof....mfhd...&#xA;00000120: 00 00 00 01 BD 00 00 00 50 74 72 61 66 00 00 00    ....=...Ptraf...&#xA;00000130: 10 74 66 68 64 00 02 00 00 00 00 00 01 00 00 00    .tfhd...........&#xA;00000140: 14 74 66 64 74 01 00 00 00 00 00 00 00 00 00 67    .tfdt..........g&#xA;00000150: DB 00 00 00 24 74 72 75 6E 01 00 0F 01 00 00 00    [...$trun.......&#xA;00000160: 01 00 00 00 70 00 00 00 3C 00 00 3E E0 00 01 00    ....p...&lt;..>`...&#xA;00000170: 00 00 00 00 00 00 00 3E E8 6D 64 61 74 00 00 3E    .......>hmdat..>&#xA;00000180: DC 41 E1 81 80 93 BE 16 2B 33 77 3D 4C B6 55 8B    \Aa...>.&#x2B;3w=L6U.&#xA;00000190: D2 55 60 92 05 F7 F7 A4 97 54 4B 6C A6 68 48 84    RU`..ww$.TKl&amp;hH.&#xA;000001a0: 68 FF D2 B6 6C 02 31 FC 24 01 78 EA BD 20 AD 15    h.R6l.1|$.xj=.-.&#xA;000001b0: F1 73 31 4B EB EF 18 1B 50 B3 13 F2 DC C6 4C E1    qs1Kko..P3.r\FLa&#xA;000001c0: 75 8B 94 52 6B C5 09 37 55 1E 45 66 6A 92 39 23    u..RkE.7U.Efj.9#&#xA;000001d0: C9 2D FD BB EC AD FD CF C4 30 75 FF 44 66 FA 85    I-};l-}OD0u.Dfz.&#xA;000001e0: D9 7C 18 72 AE 63 45 60 DD D7 65 44 84 49 95 8D    Y|.r.cE`]WeD.I..&#xA;000001f0: 2C 70 6C 57 8E E9 A9 EB B6 F6 78 BD D6 88 99 F6    ,plW.i)k6vx=V..v&#xA;00000200: FC 25 B1 0A FF DF CB 77 6A 67 37 24 A5 3D 8F A1    |%1.._Kwjg7$%=.!&#xA;00000210: 27 9B 4F 42 0E CD B8 87 6E C9 99 FC 6F 4C 53 4B    &#x27;.OB.M8.nI.|oLSK&#xA;00000220: 01 EA B6 AF 99 F8 22 C1 8F 1E C1 66 D6 8A 09 D6    .j6/.x"A..AfV..V&#xA;00000230: 99 79 91 F7 C1 2A 08 1F 81 CB 5E DD C3 CA 86 8F    .y.wA*...K^]CJ..&#xA;00000240: 57 BF 17 A2 64 6B 69 56 AE 19 1F 57 AD A6 D8 C2    W?."dkiV...W-&amp;XB&#xA;00000250: 06 28 EB 46 D3 E4 85 51 3E E2 A5 40 50 50 85 7D    .(kFSd.Q>b%@PP.}&#xA;00000260: 72 6B 20 87 1A 6E 73 E1 B8 88 9E 20 23 48 6D FE    rk...nsa8...#Hm~&#xA;00000270: C2 0D 39 ED 24 B2 6D B5 9B 81 B6 BC F4 EE DE A2    B.9m$2m5..6..bB.{"&amp;.!4.R^5&#xA;000002b0: 2A A6 E2 71 D7 4F 96 0A EC AE 8D 39 27 B8 CF 61    *&amp;bqWO..l..9&#x27;8Oa&#xA;000002c0: CC ED E9 AF 74 C3 95 D3 E3 96 32 20 E6 31 0B E4    Lmi/tC.Sc.2.f1.d&#xA;000002d0: DC F4 FF 41 37 36 E7 DB 87 AE B3 7D BF CA F8 05    \t.A76g[..3}?Jx.&#xA;000002e0: 72 2A 38 AB B8 8E 98 43 97 C8 5E 80 57 C6 E7 1E    r*8&#x2B;8..C.H^.WFg.&#xA;000002f0: 86 75 CE CD CE BF CF 10 C9 8A C2 C9 6E 33 41 AC    .uNMN?O.I.BIn3A,&#xA;00000300: 91 AC A8 F3 1B E6 D5 0A 22 A1 2C 4C 68 19 51 4D    .,(s.fU."!,Lh.QM&#xA;00000310: 17 DA AE E1 D7 BC 0E 2D F8 14 61 E2 4F BA 26 A3    .Z.aW&lt;.-x.abO:&amp;#&#xA;00000320: 0A E4 A6 BE 08 EA 3C 28 E6 C5 6B CA 3A 86 D2 59    .d&amp;>.j&lt;(fEkJ:.RY&#xA;00000330: 34 C2 ED 91 72 5A EF 2C BE D7 38 A4 60 D7 F3 97    4Bm.rZo,>W8$`Ws.&#xA;00000340: BB E6 FD C2 D0 29 10 B5 A4 79 D8 3E 61 48 8A F9    ;f}BP).5$yX>aH.y&#xA;00000350: C6 D8 13 D0 FD DB D6 FA 24 7F CD 5A BF 06 57 49    FX.P}[Vz$.MZ?.WI&#xA;00000360: 51 EC ED B2 74 AB 92 1D 37 68 70 A2 A5 31 B5 5F    Qlm2t&#x2B;..7hp"%15_&#xA;00000370: EA CF 9E 3E 6A B1 78 16 B7 94 D1 46 7B 63 C1 67    jO.>j1x.7.QF{cAg&#xA;00000380: D2 B0 08 44 64 1E 68 15 39 80 E3 DD EB C0 E1 71    R0.Dd.h.9.c]k@aq&#xA;00000390: E8 EE D0 4D DF 4F 41 E0 96 C5 34 AD BC D3 9E 88    hnPM_OA`.E4-&#x27;.7pV%_>.T..&#xA;00000430: 7F FC AD 71 CE AF 54 8B 5D DC 27 34 20 A3 0A 73    .|-qN/T.]\&#x27;4.#.s&#xA;00000440: 76 A5 81 33 22 31 56 6B 1D 82 C4 32 FB 82 15 F6    v%.3"1Vk..D2{..v&#xA;00000450: 97 C8 47 29 3C 9E 59 9A C0 83 48 A0 55 CB C8 D6    .HG)&lt;.Y.@.H.UKHV&#xA;00000460: 36 92 CC 54 A7 00 E3 28 9E 99 45 B2 E5 7E 88 A7    6.LT&#x27;.c(..E2e~.&#x27;&#xA;00000470: 28 4E CA 75 17 3C D3 B5 6C F5 FD AC 05 55 BF F7    (NJu.?{.T2Yr.h.wYGw&#xA;000004d0: 3C 19 C8 7B 81 9B 17 19 E9 81 A0 36 AD C6 62 71    &lt;.H{....i..6-Fbq&#xA;000004e0: DB 68 72 8F 6A 37 45 D9 0E 6E DC 2C 5E 52 C2 75    [hr.j7EY.n\,^RBu&#xA;000004f0: 51 2F F9 CE 8A 10 12 E9 C8 68 A9 D6 A6 D7 5B 14    Q/yN...iHh)V&amp;W[.&#xA;00000500: 11 51 42 FD BE B5 09 56 7F 19 C3 EB A7 A6 DF 6C    .QB}>5.V..Ck&#x27;&amp;_l&#xA;00000510: 55 A3 11 DC EF 81 C3 CD DD 63 BF 38 F8 5A 4A 45    U#.\o.CM]c?8xZJE&#xA;00000520: 33 24 7B A4 55 B3 85 A6 87 75 3B 85 51 5C 03 B7    3${$U3.&amp;.u;.Q\.7&#xA;

    &#xA;

    UPDATE TO THE CODE

    &#xA;

    1st Packet find here&#xA;2nd Packet find here

    &#xA;

    I have updated the code as per one of the comment to read only MDAT box to retrieve H264 stream from the incoming bytes[] through the socket, now I send only MDAT box contents (next byte after MDAT box)

    &#xA;

    public Map.Entry> hasMdat(byte[] byteArray) {&#xA;    for (int i = 0; i &lt; byteArray.length - 3; i&#x2B;&#x2B;) {&#xA;        if (byteArray[i] == (byte) 109 &amp;&amp;&#xA;                byteArray[i &#x2B; 1] == (byte) 100 &amp;&amp;&#xA;                byteArray[i &#x2B; 2] == (byte) 97 &amp;&amp;&#xA;                byteArray[i &#x2B; 3] == (byte) 116) {&#xA;&#xA;            return Map.entry(true, Arrays.asList(i, i &#x2B; 1, i &#x2B; 2, i &#x2B; 3));&#xA;        }&#xA;    }&#xA;    return Map.entry(false, List.of(0));&#xA;}&#xA;

    &#xA;

    This is my code which handles the byte stream

    &#xA;

    initSocketConnection(new VideoStreamCallback() {&#xA;        @Override&#xA;        public void onVideoStreamReceived(byte[] bytes) {&#xA;           &#xA;Map.Entry> b = hasMdat(bytes);&#xA;        if (b.getKey()) {&#xA;            byte[] b1 = Arrays.copyOfRange(bytes, b.getValue().get(3) &#x2B; 1, bytes.length);&#xA;  //write b1 back to client using spring SSE&#xA;            &#xA;        }&#xA;&#xA;        }&#xA;    });&#xA;

    &#xA;