Recherche avancée

Médias (0)

Mot : - Tags -/optimisation

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

Autres articles (46)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (9830)

  • 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

  • How can I reencode a video to match another's codec exactly ?

    24 janvier 2020, par Stephen Schrauger

    When I’m on vacation, I usually use our camcorder to record videos. Since they’re all the same format, I can use ffmpeg to concat them into one large, smooth video without re-encoding.

    However, sometimes I will use a phone or other camera to record a video (if the camcorder ran out of space/battery or was left at a hotel).

    I’d like to determine the codec, framerate, etc used by my camcorder and use those parameters to convert the phone vidoes into the same format. That way, I will be able to concatonate all the videos without re-encoding the camcorder videos.

    Using ffprobe, I found my camcorder has this encoding :

     Input #0, mpegts, from 'camcorderfile.MTS':
     Duration: 00:00:09.54, start: 1.936367, bitrate: 24761 kb/s
     Program 1
       Stream #0:0[0x1011]: Video: h264 (High) (HDPR / 0x52504448), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
       Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 256 kb/s
       Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080

    The phone (iPhone 5s) encoding is :

     Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mov.MOV':
     Metadata:
       major_brand     : qt  
       minor_version   : 0
       compatible_brands: qt  
       creation_time   : 2017-01-02T03:04:05.000000Z
       com.apple.quicktime.location.ISO6709: +12.3456-789.0123+456.789/
       com.apple.quicktime.make: Apple
       com.apple.quicktime.model: iPhone 5s
       com.apple.quicktime.software: 10.2.1
       com.apple.quicktime.creationdate: 2017-01-02T03:04:05-0700
     Duration: 00:00:14.38, start: 0.000000, bitrate: 11940 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 11865 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1200 tbc (default)
       Metadata:
         creation_time   : 2017-01-02T03:04:05.000000Z
         handler_name    : Core Media Data Handler
         encoder         : H.264
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s (default)
       Metadata:
         creation_time   : 2017-01-02T03:04:05.000000Z
         handler_name    : Core Media Data Handler
       Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
       Metadata:
         creation_time   : 2017-01-02T03:04:05.000000Z
         handler_name    : Core Media Data Handler
       Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
       Metadata:
         creation_time   : 2017-01-02T03:04:05.000000Z
         handler_name    : Core Media Data Handler

    I’m presuming that ffmpeg will automatically take any acceptable video format, and that I only need to figure out the output settings. I think I need to use -s 1920x1080 and -pix_fmt yuv420p for the output, but what other flags do I need in order to make the phone video into the same encoding as the camcorder video ?

    Can I get some pointers as to how I can translate the ffprobe output into the flags I need to give to ffmpeg ?

    Edit : Added the entire Input #0 for both media files.

  • Events after FFmpeg in Cmd command is completed in C#

    30 juin 2017, par Манаф Иракский

    I am creating windows form application using C# to manage cmd arguments of FFMPEG, also, I am using FileWatcher, my application as long as its running after clicking the button "start watching" is will watch if any new file landed in the folder, its will open CMD.exe and the argument will use FFMPEG to convert this Video file. its working but the issue is my C# application sends the command to cmd and thats it but I want to handle other tasks like if FFMPEG completed the task delete the original file ? how I can determine in my app thats CMD command completed and then start next task. here is my cod

    namespace WindowsFormsApplication1

    public partial class Form1 : Form

    public Form1()

    InitializeComponent() ;

       private void button1_Click(object sender, EventArgs e)
       {

           FileSystemWatcher watcher = new System.IO.FileSystemWatcher();
           watcher.Path = @"MY PATH";
           watcher.NotifyFilter = NotifyFilters.LastWrite;
           watcher.Filter = "*.*";
           watcher.Changed += new FileSystemEventHandler(OnChanged);
           watcher.EnableRaisingEvents = true;


       }

       private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e)
       {


       }
       private void OnChanged(object source, FileSystemEventArgs e)
       {

            DirectoryInfo d = new DirectoryInfo(InPath .Text );
           FileInfo[] Files = d.GetFiles("*.*");
           string str = "";
           foreach (FileInfo file in Files)
           {
               str = str + file.Name;
           }

           var strout = Path.GetFileNameWithoutExtension(str);
           string strCmdText;
           strCmdText = @"/C ffmpeg.exe -i X.mp4 -Vcodec X Xout.mp4"; /// this is just argument example
           System.Diagnostics.Process.Start("CMD.exe", strCmdText);


       }



       private void Form1_Load(object sender, EventArgs e)
       {



       }

    }