簡體   English   中英

使用可調整png圖像的ffmpeg在視頻上疊加圖像

[英]Overlay image on video using ffmpeg with adjustable png image

我的png圖像是一個生日幀,我想將其精確地放置在視頻的頂部,視頻和圖像的所有角都重疊。 我已附上我的輸出圖像。

我得到的輸出是這個

這是我正在使用的命令-

String[] cmd = new String[]{ "-i", slideVid, "-i", sdPath, "-filter_complex", "overlay=0:main_w-overlay_w", outputFile.getPath()};

請幫忙 !!

這很好。 在Moto G4,nexus 7和Sony XA DUAL上進行了測試。 輸出圖像

 private void execFFmpegBinaryShortest(final String[] command) {
        final File outputFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/slideShowMusic/"+"Vid"+"output"+i1+".mp4");

         String[] cmd = new String[]{  "-y", "-i", slideVid, "-i", sdPath ,"-filter_complex", "[1][0]scale2ref[i][m];[m][i]overlay[v]" ,"-map", "[v]", "-map",  "0:a?", "-ac", "2", outputFile.getPath()};

         try {

            ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {
                @Override
                public void onFailure(String s) {
                    System.out.println("on failure----"+s);
                }

                @Override
                public void onSuccess(String s) {
                    System.out.println("on success-----"+s);
                }

                @Override
                public void onProgress(String s) {
                    //Log.d(TAG, "Started command : ffmpeg "+command);
                    System.out.println("Started---"+s);

                   mBtnNext.setText("Converting-->"+s);


                }

                @Override
                public void onStart() {
                    //Log.d(TAG, "Started command : ffmpeg " + command);
                    System.out.println("Start----");}

                @Override
                public void onFinish() {
                    System.out.println("Finish-----");
                    Intent i = new Intent(imageOverlay.this, addAudio.class);
                    System.out.println("!!!!!!!!"+outputFile);
                    i.putExtra("slideVid",outputFile.getPath());
                    startActivity(i);
                }
            });
        } catch (FFmpegCommandAlreadyRunningException e) {
            // do nothing for now
            System.out.println("exceptio :::"+e.getMessage());
        }


    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM