Recherche avancée

Médias (91)

Autres articles (67)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • Formulaire personnalisable

    21 juin 2013, par

    Cette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
    Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire. (...)

  • 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

Sur d’autres sites (8757)

  • Cannot decode H.264 stream (Annex.B) using FFmpeg

    15 décembre 2014, par user849642

    Recently I’m writing a client of a IP camera providing H.264 stream. I’m now using FFmpeg 2.1.1 to decode the stream provided by the camera.

    Here’s some code of the application :

    Initialization :

       private unsafe void InitFFmpeg()
       {
           FFmpeg.avcodec_register_all();
           var codec = FFmpeg.avcodec_find_decoder(AVCodecID.AV_CODEC_ID_H264);
           avcodec = (IntPtr)codec;

           var ctx=FFmpeg.avcodec_alloc_context3(avcodec);
           avcontext = (IntPtr)ctx;

           ctx->codec = avcodec;
           ctx->pix_fmt = AVPixelFormat.PIX_FMT_YUV420P;
           ctx->flags2 |= 0x00008000;//CODEC_FLAG2_CHUNKS

           var options = IntPtr.Zero;
           int result = FFmpeg.avcodec_open2(avcontext, avcodec, ref options);
           avframe = FFmpeg.av_frame_alloc();
           avparser = FFmpeg.av_parser_init(AVCodecID.AV_CODEC_ID_H264);
           FFmpeg.av_init_packet(ref avpacket);
           inBuffer = Marshal.AllocHGlobal(300 * 1024);
       }

    Decoding :

       private void Decode(byte[] data, int size)
       {
           IntPtr pOut = IntPtr.Zero;
           int outLen = 0;

           Marshal.Copy(data, 0, inBuffer, size);

           int gotPicture = 0;

           var rs = FFmpeg.av_parser_parse2(avparser, avcontext, ref pOut, ref outLen, inBuffer, size, 0, 0, 0);
           if (outLen <= 0 || pOut.ToInt32() <= 0)
           {
               //no enough data to construct a frame, return and receive next NAL unit.
               return;
           }
           avpacket.data = pOut;
           avpacket.size = outLen;
           avpacket.flags |= PacketFlags.Key;
           var len = FFmpeg.avcodec_decode_video2(avcontext, avframe, ref gotPicture, ref avpacket);
           Console.WriteLine("avcodec_decode_video2 returned " + len);
           if (gotPicture != 0)
           {
               //some YUV to RGB stuff
           }
       }

    With the code above, I can get some output like :

    NAL unit 1: resolution=1280x720, key-frame=True, size=26.
    NAL unit 2: resolution=1280x720, key-frame=False, size=8.
    NAL unit 3: resolution=1280x720, key-frame=False, size=97222.
    NAL unit 4: resolution=1280x720, key-frame=False, size=14129.
    avcodec_decode_video2 returned 1
    NAL unit 5: resolution=1280x720, key-frame=False, size=12522.
    NAL unit 6: resolution=1280x720, key-frame=False, size=12352.
    avcodec_decode_video2 returned 1
    NAL unit 7: resolution=1280x720, key-frame=False, size=12291.
    NAL unit 8: resolution=1280x720, key-frame=False, size=12182.

    From the ouput I can see the parser can recognize the NAL units sent by the camera and can construct frames from them.

    NAL unit 1 to 4 are slices of a key frame containing SPS/PPS, and the following 2 NAL units form a normal frame.

    And the avcodec_decode_video2 function doesn’t produce any error, but just keep returning 1 and gotPicture is alway 0.

    If I clear AVCodecContext.flags2, it starts to complain that the packet I provided contains no frame :

    NAL unit 100: resolution=1280x720, frame-rate=0, key-frame=True, size=26.
    NAL unit 101: resolution=1280x720, frame-rate=0, key-frame=False, size=8.
    NAL unit 102: resolution=1280x720, frame-rate=0, key-frame=False, size=96927.
    NAL unit 103: resolution=1280x720, frame-rate=0, key-frame=False, size=17149.
    [h264 @ 01423440] no frame!
    avcodec_decode_video2 returned -1094995529
    NAL unit 104: resolution=1280x720, frame-rate=0, key-frame=False, size=12636.
    NAL unit 105: resolution=1280x720, frame-rate=0, key-frame=False, size=12338.
    [h264 @ 01423440] no frame!

    If I write the raw stream to a file, I can use FFmpeg to mux the stream to an mp4 container, and can play the mp4 file with any player.

    The raw data I received is something like :

    00 00 00 01 67 42 00 28 E9 00 A0 0B 75 C4 80 03 6E E8 00 CD FE 60 0D 88 10 94
    00 00 00 01 68 CE 31 52
    00 00 00 01 65 88 81 00 06 66 36 25 11 21 2C 04 3B 81 E1 80 00 85 4B 23 9F 71...
    ...
  • Concat two mp4 files with MP4Box error : Bad Parameter [on hold]

    6 février 2014, par user3279646

    I'm trying to concat two mp4 files. But I get an error : Bad Parameter

    Can someone help me with this problem ?

    I'm using de debian packages. On a previously version it worked fine. I moved from a old debian version to the new one and I also had to change the ffmpeg to avconv which I use to create these mp4 files. I also had to change the audio codec to '-acodec aac -strict experimental'

    Kind Regards,
    Marcel

       MP4Box -force-cat -cat conv1-1391608417314.mp4 -add conv1-1391608417345.mp4 -new output.mp4
       IsoMedia import - track ID 1 - Video (size 384 x 288)
       Error importing conv1-1391608417345.mp4: Bad Parameter

       MP4Box -info conv1-1391608417314.mp4
       Movie Info
       Timescale 1000 - Duration 00:00:23.985
       Fragmented File no - 2 track(s)
       File Brand isom - version 512
       Created: UNKNOWN DATE
       File has root IOD (9 bytes)
       Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
       Visual PL: Not part of MPEG-4 Visual profiles (0xfe)
       Audio PL: Not part of MPEG-4 audio profiles (0xfe)
       No streams included in root OD

       iTunes Info:
       Encoder Software: Lavf53.21.1

       Track # 1 Info - TrackID 1 - TimeScale 1000 - Duration 00:00:23.985
       Media Info: Language "Undetermined" - Type "vide:avc1" - 23988 samples
       Visual Track layout: x=0 y=0 width=384 height=288
       MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
       AVC/H264 Video - Visual Size 384 x 288
       AVC Info: 1 SPS - 1 PPS - Profile High @ Level 4.2
       NAL Unit length bits: 32
       Self-synchronized

       Track # 2 Info - TrackID 2 - TimeScale 44100 - Duration 00:00:23.962
       Media Info: Language "Undetermined" - Type "soun:mp4a" - 1032 samples
       MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
       MPEG-4 Audio MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 44100
       Synchronized on stream 1
       Alternate Group ID 1

       MP4Box -version
       MP4Box - GPAC version 0.5.0-rev
       GPAC Copyright: (c) Jean Le Feuvre 2000-2005
       (c) ENST 2005-200X
       GPAC Configuration: --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --libdir=${prefix}/lib/x86_64-linux-gnu --libexecdir=${prefix}/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --mandir=${prefix}/share/man --libdir=lib/x86_64-linux-gnu --extra-cflags='-Wall -fPIC -DPIC -I/usr/include/mozjs -DXP_UNIX' --enable-joystick --enable-debug --disable-ssl
       Features: GPAC_HAS_JPEG GPAC_HAS_PNG
  • how to save h264 stream into .264 file

    6 mars 2015, par user3547405

    I’m using nginx-rtmp-module build hls server, when I play it on safari, it does not shows image,then i use this command ffmpeg -i rtmp://192.168.4.213/hls/testH264 -c copy -map 0 -f segment -segment_list playlist.m3u8 -segment_time 5 output%03d.ts, it shows missing picture in access unit with size 28184,so i think maybe the raw h264 stream has some problem,then i directly save the h264 stream into .264 file,but when i play the .264 file with vlc,the screen is fuzzy,help