Recherche avancée

Médias (1)

Mot : - Tags -/publishing

Autres articles (90)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • L’utiliser, en parler, le critiquer

    10 avril 2011

    La première attitude à adopter est d’en parler, soit directement avec les personnes impliquées dans son développement, soit autour de vous pour convaincre de nouvelles personnes à l’utiliser.
    Plus la communauté sera nombreuse et plus les évolutions seront rapides ...
    Une liste de discussion est disponible pour tout échange entre utilisateurs.

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

Sur d’autres sites (10911)

  • AV_PIX_FMT_YUVJ422P to jpeg conversion

    4 mars 2019, par user3743908

    i am able to convert image from AV_PIX_FMT_YUVJ422P to jpeg format (below Code) but the resultant image having green shade on complete bottom half plz suggest where i am doing wrong.
    Following step i have taken

    1. Initially i have AV_PIX_FMT_UYVY422 image from camera, i have convert it in AV_PIX_FMT_YUVJ422P format and able to see this image on http://rawpixels.net/ the parameters shown by website is size 2448X2050, Bpp1= 8,Bpp2 = 8 and Bpp3 = 8,alignment 1, SubSampling H =2, and SubSampling V = 1, format : YUV422P
      so input image is Correct AV_PIX_FMT_YUVJ422P format. & also able to see on "YUV image viewer Software" using YUV422 format.

    2. Now i am trying to convert it in jpeg format using below Code and attached is the resultant Image having green shade on complete bottom half.

         AVFormatContext*    pFormatCtx;
         AVOutputFormat*     fmt;
         AVStream*           video_st;
         AVCodecContext*     pCodecCtx;
         AVCodec*            pCodec;

         uint8_t*            picture_buf;
         AVFrame*            picture;
         AVPacket            pkt;
         int                 y_size;
         int                 size;
         int                 got_picture=0;  
         int                 ret=0;

      int main( int argc, char* argv[] )
      {

         FILE *in_file                       =   NULL;  
         unsigned int        in_width        =   2448;    
         unsigned int        in_height       =   2050;  
         const char* out_file                =   "encoded_pic.jpg";    


             in_file =   fopen("c:\\test_Planar.yuv","rb");
             if(in_file == NULL) { printf("\n\tFile Opening error...!!"); exit(1); }
             else printf("\n\tYUV File Open Sucessfully...!!\n\n");

             av_register_all();  // Loads the whole database of available codecs and formats.

             pFormatCtx          =   avformat_alloc_context();          
             fmt             =   NULL;
             fmt             =   av_guess_format("mjpeg",NULL,NULL);
             pFormatCtx->oformat     =   fmt;

      //------Output URL-------------------------
      if (avio_open(&pFormatCtx->pb,out_file, AVIO_FLAG_READ_WRITE) < 0)
      {
         printf("Couldn't open output file.");
         return -1;
      }

      video_st = avformat_new_stream(pFormatCtx, 0);    
      if (video_st==NULL)        return -1;


      pCodecCtx               =   video_st->codec;
      pCodecCtx->codec_id     =   fmt->video_codec;
      pCodecCtx->codec_type   =   AVMEDIA_TYPE_VIDEO;
      pCodecCtx->pix_fmt      =   AV_PIX_FMT_YUVJ422P;

      //--------------------------MY SOURCE PIXEL FORMAT--------------

      pCodecCtx->width        =   in_width;
      pCodecCtx->height       =   in_height;

      pCodecCtx->time_base.num = 1;
      pCodecCtx->time_base.den = 1;//25;

      //Output some information
      av_dump_format(pFormatCtx, 0, out_file, 1);

      // Determine if desired video encoder is installed
      pCodec = avcodec_find_encoder(pCodecCtx->codec_id);

      if (!pCodec)
      {
         printf("Codec not found.");
         return -1;
      }

      printf("\nCodec Identified done\n");

      if (avcodec_open2(pCodecCtx, pCodec,NULL) < 0){
         printf("Could not open codec.\n");
         return -1;
      }
      picture     =   av_frame_alloc();
      size            =   avpicture_get_size(pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);
      picture_buf     =   (uint8_t *)av_malloc(size);
      if (!picture_buf)    return -1;

      avpicture_fill((AVPicture *)picture, picture_buf, pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);

      printf("\t\nWrite Header..");
      avformat_write_header(pFormatCtx,NULL);
      y_size = pCodecCtx->width * pCodecCtx->height;
      av_new_packet(&pkt,y_size*3);


      //Read YUV
      if (fread(picture_buf, 1, y_size*3/2, in_file) <=0)
      {
         printf("Could not read input file.");
         return -1;
      }
      //--------------------------------------------input image format UYVY
      picture->data[0] = picture_buf;             // Y
      picture->data[1] = picture_buf+ y_size;         // U
      picture->data[2] = picture_buf+ y_size*5/4;     // V
      //-----------------------------------------------

      printf("\t\n Encode the image..\n");
      ret = avcodec_encode_video2(pCodecCtx, &pkt,picture, &got_picture);
      if(ret < 0)
      {
         printf("Encode Error.\n");
         return -1;
      }

      if (got_picture==1)
      {
         pkt.stream_index = video_st->index;
         ret = av_write_frame(pFormatCtx, &pkt);
      }

      av_free_packet(&pkt);
      //Write Trailer
      av_write_trailer(pFormatCtx);    
      printf("Encode Successful.\n");

      if (video_st)
      {
         avcodec_close(video_st->codec);
         av_free(picture);
         av_free(picture_buf);
      }

      avio_close(pFormatCtx->pb);
      avformat_free_context(pFormatCtx);    

         fclose(in_file);
         printf("\n\tYUV File Close Sucessfully...!!");    
      }

    Resultant output jpeg encoded image from yuvj422p image having green shade

  • FFMPEG error when saving NDI stream to mp4

    22 septembre 2020, par user1163234

    I am trying to record a NDI stream to a MP4 file(I want to stream the mp4 to rtmp endpoint after saving file). However I am getting this error when running this class. https://github.com/WalkerKnapp/devolay/blob/master/examples/src/main/java/com/walker/devolayexamples/recording/RecordingExample.java

    


    Error :

    


    Connecting to source: DESKTOP-GQNH46Q (Ari PC output)
[file @ 0x7fb4f2d48540] Setting default whitelist 'file,crypto'
x265 [info]: HEVC encoder version 0.0
x265 [info]: build info [Mac OS X][clang 8.1.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-3.1 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 1 / wpp(12 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias: 1 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra
x265 [info]: tools: strong-intra-smoothing lslices=4 deblock sao
[SWR @ 0x7fb4f8893000] Using fltp internally between filters
[mp4 @ 0x7fb4f3820200] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 135 >= 107
Failed to write video flush packet, skipping: Invalid argument
configurationVersion:                1
general_profile_space:               0
general_tier_flag:                   0
general_profile_idc:                 1
general_profile_compatibility_flags: 0x60000000
general_constraint_indicator_flags:  0x900000000000
general_level_idc:                   93
min_spatial_segmentation_idc:        0
parallelismType:                     0
chromaFormat:                        1
bitDepthLumaMinus8:                  0
bitDepthChromaMinus8:                0
avgFrameRate:                        0
constantFrameRate:                   0
numTemporalLayers:                   1
temporalIdNested:                    1
lengthSizeMinusOne:                  3
numOfArrays:                         4
array_completeness[0]:               0
NAL_unit_type[0]:                    32
numNalus[0]:                         1
nalUnitLength[0][0]:                 24
array_completeness[1]:               0
NAL_unit_type[1]:                    33
numNalus[1]:                         1
nalUnitLength[1][0]:                 41
array_completeness[2]:               0
NAL_unit_type[2]:                    34
numNalus[2]:                         1
nalUnitLength[2][0]:                 7
array_completeness[3]:               0
NAL_unit_type[3]:                    39
numNalus[3]:                         1
nalUnitLength[3][0]:                 2050
[AVIOContext @ 0x7fb4f2d48640] Statistics: 2 seeks, 4 writeouts
x265 [info]: frame I:      1, Avg QP:14.03  kb/s: 16.33   
x265 [info]: frame P:     36, Avg QP:21.67  kb/s: 0.04    
x265 [info]: frame B:     73, Avg QP:24.22  kb/s: 0.03    
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x265 [info]: consecutive B-frames: 28.9% 13.2% 18.4% 2.6% 36.8% 

encoded 110 frames in 15.13s (7.27 fps), 0.18 kb/s, Avg QP:23.29
[aac @ 0x7fb4f6aa6200] Qavg: 65536.000


    


  • ffmpeg API : handle frame loss in hevc encoding

    8 janvier 2024, par Mario

    Everything works fine until the introduction of frame->pts increment due to frame loss.

    


    Below is the regular progression without frame->pts increments :

    


    


    frame->pts=8 pkt->pts=512 pkt->dts=-512 pkt->flags=1
    
frame->pts=9 pkt->pts=2560 pkt->dts=0 pkt->flags=0
    
frame->pts=10 pkt->pts=1536 pkt->dts=512 pkt->flags=0
    
frame->pts=11 pkt->pts=1024 pkt->dts=1024 pkt->flags=0
    
frame->pts=12 pkt->pts=2048 pkt->dts=1536 pkt->flags=0
    
frame->pts=13 pkt->pts=4608 pkt->dts=2048 pkt->flags=0
    
frame->pts=14 pkt->pts=3584 pkt->dts=2560 pkt->flags=0
    
frame->pts=15 pkt->pts=3072 pkt->dts=3072 pkt->flags=0
    
frame->pts=16 pkt->pts=4096 pkt->dts=3584 pkt->flags=0
    
frame->pts=17 pkt->pts=6656 pkt->dts=4096 pkt->flags=0
    
frame->pts=18 pkt->pts=5632 pkt->dts=4608 pkt->flags=0

    


    


    When I introduce the frame->pts increment it happens :

    


    


    frame->pts=15 pkt->pts=512 pkt->dts=-512 pkt->flags=1
    
frame->pts=17 pkt->pts=4608 pkt->dts=2048 pkt->flags=0
    
frame->pts=19 pkt->pts=2560 pkt->dts=1536 pkt->flags=0
    
[mp4 @ 0x7eff842222c0] Application provided invalid, non monotonically increasing dts to muxer in stream 0 : 2048 >= 1536

    


    


    So I wrote the following code as a "quick" solution (between av_packet_rescale_ts() and av_interleaved_write_frame()) :

    


       av_packet_rescale_ts(pkt, c->time_base, st->time_base);  
   ...
   if (pkt->dts<=previous_dts)  
     {  
      if (pkt->pts<=previous_pts)  
        {  
         pkt->pts=previous_dts+1+pkt->pts-pkt->dts;  
        }  
       pkt->dts=previous_dts+1;  
     }  
   previous_dts=pkt->dts;  
   previous_pts=pkt->pts;  
   ...
   ret = av_interleaved_write_frame(fmt_ctx, pkt);  


    


    Now I no longer have the error, but the values are :

    


    


    frame->pts=15 pkt->pts=512 pkt->dts=-512 pkt->flags=1
    
changed frame->pts=15 pkt->pts=512 pkt->dts=1 pkt->flags=1
    
frame->pts=17 pkt->pts=4608 pkt->dts=2048 pkt->flags=0
    
frame->pts=19 pkt->pts=2560 pkt->dts=1536 pkt->flags=0
    
changed frame->pts=19 pkt->pts=3073 pkt->dts=2049 pkt->flags=0
    
frame->pts=21 pkt->pts=1536 pkt->dts=1536 pkt->flags=0
    
changed frame->pts=21 pkt->pts=2050 pkt->dts=2050 pkt->flags=0
    
frame->pts=23 pkt->pts=4096 pkt->dts=3584 pkt->flags=0
    
frame->pts=25 pkt->pts=8704 pkt->dts=6144 pkt->flags=0
    
frame->pts=27 pkt->pts=6656 pkt->dts=5632 pkt->flags=0
    
changed frame->pts=27 pkt->pts=7169 pkt->dts=6145 pkt->flags=0
    
frame->pts=29 pkt->pts=5632 pkt->dts=5632 pkt->flags=0
    
changed frame->pts=29 pkt->pts=6146 pkt->dts=6146 pkt->flags=0
    
frame->pts=31 pkt->pts=7680 pkt->dts=7168 pkt->flags=0
    
frame->pts=33 pkt->pts=12800 pkt->dts=10240 pkt->flags=0
    
frame->pts=35 pkt->pts=10752 pkt->dts=9728 pkt->flags=0
    
changed frame->pts=35 pkt->pts=11265 pkt->dts=10241 pkt->flags=0
    
frame->pts=37 pkt->pts=9728 pkt->dts=9728 pkt->flags=0
    
changed frame->pts=37 pkt->pts=10242 pkt->dts=10242 pkt->flags=0

    


    


    What is the correct way to handle frame loss scenario ?
Is there a way to inform the encoder about frame loss ?

    


    The encoder is "hevc_qsv" and the output format is mov (.mp4).