Monday, August 15, 2011

Replace img_convert by swscale for ffmpeg


//        img_convert(&pFrameRGB, PIX_FMT_RGB24,
//        (AVPicture *)pFrame, pCodecCtx->pix_fmt,
//        pCodecCtx->width, pCodecCtx->height);

        static struct SwsContext *img_convert_ctx;
        int w = pCodecCtx->width;
        int h = pCodecCtx->height;
        img_convert_ctx = sws_getContext(w, h,
        pCodecCtx->pix_fmt,
        w, h, PIX_FMT_RGB24, SWS_BICUBIC,
        NULL, NULL, NULL);

        sws_scale(
        img_convert_ctx,pFrame->data, pFrame->linesize,0,
        pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);

Sunday, August 14, 2011

Friday, August 12, 2011

How to close the cmd.exe progress in C#


currentCommand = programPath + "\\ShotSegmentation.exe " + videoPath + "\\" + currentVideoFile + " " + outputPath + "\\" + currentOutputFile;

                    //MessageBox.Show(currentCommand);

                    proc = new Process();
                    proc.StartInfo.CreateNoWindow = true;
                    proc.StartInfo.UseShellExecute = false;
                    proc.StartInfo.RedirectStandardOutput = true;

                    proc.StartInfo.RedirectStandardError = true;
                    proc.StartInfo.FileName = "cmd.exe";

                    proc.StartInfo.Arguments = "/C " + currentCommand;                  

                    proc.Start();
                    string output = proc.StandardOutput.ReadToEnd();
                    proc.WaitForExit();