Recherche avancée

Médias (0)

Mot : - Tags -/flash

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (109)

  • 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

  • Taille des images et des logos définissables

    9 février 2011, par

    Dans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
    Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...)

  • Configuration spécifique d’Apache

    4 février 2011, par

    Modules spécifiques
    Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
    Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
    Création d’un (...)

Sur d’autres sites (14150)

  • how to write image with yuv420 format data with PIL or something like that

    16 avril 2021, par nathan wu

    I have a video with yuv420p pixel format. 
At first I tried to read each frame's bytes of it using pipe and pixel format as rgb24. And I used PIL to make image of it.
However, the frames read with format of rgb24 seem to lose a little bit of quality.

    



    Here is the command of reading frame with rgb24 pixel format :

    



        ffmpeg -y -i input.mp4 -vcodec rawvideo -pix_fmt rgb24 -an -r 25 -f rawvideo pipe:1
    frame_data = self.process.stdout.read(1920*1080*3)


    



    Then I tried to read it with yuv420p pixel format.

    



        ffmpeg -y -i input.mp4 -vcodec rawvideo -pix_fmt yuv420p -an -r 25 -f rawvideo pipe:1
    frame_data = self.process.stdout.read(1920*1080*3/2)


    



    One single frame includes half of the bytes of rgb24 frame. It is 3110400 bytes within a 1920*1080 yuv420p frame. I tossed these data into PIL :

    



        Image.frombytes('YCbCr', (1920, 1080), frame_data)


    



    but PIL raise an error of not enough image data.
I looked up the modes that PIL support to write from bytes, none of it is 12_bit pixels.
I also tried to transform the yuv data into rgb data, but it took a lot more time than before when is a long video to process.

    



    Am I doing something wrong ? Is there any way to write an image with raw yuv data without any transform ??

    


  • Play mp3 data with audiotrack with ffmpeg

    1er février 2014, par Ichigo Kurosaki

    I am designing an android app where i receive live mp3 data as stream from Red5 server and i need to play it.

    I cant play it using media player class as i don't have any url for the stream, nor i cant use files. Another option is to use Audio track class, but requires PCM data only. So need to convert mp3 to pcm, so using ffmpeg.

    My code for conversion is

    AVCodec *codec;
    AVCodecContext *c= NULL;
    int out_size, len;
    uint8_t *outbuf;

    int iplen=(*env)->GetArrayLength(env, mp3buf);
    int16_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
    AVPacket avpkt;
    av_init_packet(&avpkt);
    av_register_all();
    avcodec_register_all();

    codec = avcodec_find_decoder(CODEC_ID_MP3);
    if(!codec){
       __android_log_print(ANDROID_LOG_DEBUG, "logfromjni", "Codec not found");
    }
    c = avcodec_alloc_context();
    outbuf = malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
    avpkt.data = (*env)->GetByteArrayElements(env,mp3buf,NULL);

    avpkt.size = (*env)->GetArrayLength(env, mp3buf);
    out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
    int ao=avcodec_open(c, codec);
       if (ao < 0) {
           __android_log_print(ANDROID_LOG_DEBUG, "logfromjni", "avcodec not open");
       }
       len = avcodec_decode_audio3(c, (short *)outbuf, &out_size, &avpkt);

    The Problem is avcodec_decode_audio3(c, (short *)outbuf, &out_size, &avpkt); returns -1 always.

    Cant figure out whats wrong.

    Any help appreciated.

  • How can I read all the data from a pipe and prevent it from closing ?

    23 septembre 2014, par slhck

    I’m trying to read raw YUV data from a compressed file using ffmpeg and pipes with Python.
    The ffmpeg command correctly spits out frames as raw YUV data, and I’m reading it like this :

    def read_from_pipe(pipe, amount):
       raw = pipe.stdout.read(amount)
       pipe.stdout.flush()
       return raw

    pipe_ref = subprocess.Popen('ffmpeg -i "' + input + '" -r 30 -c:v rawvideo -pix_fmt yuv420p -an -f rawvideo -t 5 -',
     shell = True,
     stdout = subprocess.PIPE,
     bufsize=1920*1080*3*2)

    frame_num = 0
    while True:
       data = read_from_pipe(pipe_ref, width*height*3)

       # no more data
       if (len(data) != width*height*3))
           return results

       image = extract_image_data(data, width, height)
       # do something with image, put it into "results" and print frame / SSIM values to console
       frame_num += 1

    The problem is, as soon as ffmpeg is done converting all frames, my program stops. Since the program is a little slower than ffmpeg, it will stop receiving data and exit.

    Basically, for example, I can only work up to frame 30, then ffmpeg finishes at frame 60, and my program also exits. The command line output would say :

    Frame=25 SSIM=0.990472732391
    Frame=26 SSIM=0.98359411819
    Frame=27 SSIM=0.981074433586
    Frame=28 SSIM=0.97850843075
    frame=   60 fps= 27 q=0.0 Lsize=  182250kB time=00:00:02.00 bitrate=746496.0kbits/s dup=12 drop=0    
    video:182250kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.000000%
    Frame=29 SSIM=0.977698849804
    frame=   60 fps= 27 q=0.0 Lsize=  182250kB time=00:00:02.00 bitrate=746496.0kbits/s dup=12 drop=0    
    video:182250kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.000000%

    How can I get it to work on all frames that are output by ffmpeg ? Or is there any other easier way of obtaining the raw YUV data from any file if not through a pipe ? (I need it to work concurrently)