2017-12-13 18 views
0

私のアプリでffmpegを使用するために 'com.writingminds:FFmpegAndroid:0.3.2'ライブラリを使用しました。ビデオにテキストを追加したいです。ライブラリを追加し、指定されたメソッドを使用しましたそこにffmpegコマンドを引数として渡していますが、出力ファイルが指定されていないとしてエラーが表示されますが、コマンドに出力ファイルを追加しました。何が問題になるのか分かりません。次のようにビデオにテキストを追加中にffmpegエラーが発生しました

私のコードは次のとおりです。

`FFmpeg fFmpeg = FFmpeg.getInstance (MainActivity.this); 
      try { 
       fFmpeg.loadBinary (new LoadBinaryResponseHandler() { 

        @Override 
        public void onStart() { 
         Log.e ("onStart", "onStart load"); 
        } 

        @Override 
        public void onFailure() { 
         Log.e ("onFailure", "onFailure load"); 
        } 

        @Override 
        public void onSuccess() { 
         Log.e ("onSuccess", "onSuccess load"); 
        } 

        @Override 
        public void onFinish() { 
         Log.e ("onFinish", "onFinish load"); 
        } 
       }); 
      } catch (FFmpegNotSupportedException e) { 
       e.printStackTrace(); 
       // Handle if FFmpeg is not supported by device 
      } 

      String[] cmd = {"-y", 
        "-i", 
        "/storage/emulated/0/DCIM/Camera/VID_20171212_120337.mp4", 
        "-vf", 
        "format=yuv444p", 
        "-codec:v", 
        "drawtext=text='Title of this Video': fontcolor=white: fontsize=24: x=(w-tw)/2: y=(h/PHI)+th box=1: [email protected]", 
        "-c:v copy", 
        "outVideo.mp4" 
      }; 

      try { 
       fFmpeg.execute (cmd, new ExecuteBinaryResponseHandler() { 

        @Override 
        public void onStart() { 
         Log.e ("onStart", "onStart execute"); 
        } 

        @Override 
        public void onProgress(String message) { 
         Log.e ("onProgress execute", message); 
        } 

        @Override 
        public void onFailure(String message) { 
         Log.e ("onFailure execute", message); 
        } 

        @Override 
        public void onSuccess(String message) { 
         Log.e ("onSuccess execute", message); 
        } 

        @Override 
        public void onFinish() { 
         Log.e ("onFinish execute", "onFinish execute"); 
        } 
       }); 
      } catch (FFmpegCommandAlreadyRunningException e) { 
       e.printStackTrace(); 
       // Handle if FFmpeg is already running 
      }` 

それは次のエラーを示しています

`onFailure execute: ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (GCC) 

末尾のオプションは、コマンドライン上で発見されました。

              Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/DCIM/Camera/VID_20171212_120337.mp4': 
                   Metadata: 
                   major_brand  : mp42 
                   minor_version : 0 
                   compatible_brands: isommp42 
                   creation_time : 2017-12-12 06:33:43 
                   Duration: 00:00:04.84, start: 0.000000, bitrate: 8552 kb/s 
                   Stream #0:0(eng): Video: h264 (Baseline) (avc1/0x31637661), yuv420p, 1280x720, 7842 kb/s, SAR 1:1 DAR 16:9, 16.84 fps, 16.67 tbr, 90k tbn, 180k tbc (default) 
                   Metadata: 
                    rotate   : 90 
                    creation_time : 2017-12-12 06:33:43 
                    handler_name : VideoHandle 
                   Side data: 
                    displaymatrix: rotation of -90.00 degrees 
                   Stream #0:1(eng): Audio: aac (LC) (mp4a/0x6134706D), 48000 Hz, stereo, fltp, 96 kb/s (default) 
                   Metadata: 
                    creation_time : 2017-12-12 06:33:43 
                    handler_name : SoundHandle 
                  **At least one output file must be specified**` 
+0

このCMD = { "-Y" "-i"、 "/storage/emulated/0/DCIM/Camera/VID_20171212_120337.mp4"、 "-vf" []コマンド文字列であります、"format = yuv444p"、 "-codec:v"、 "このビデオのタイトル:fontcolor = white:fontsize = 24:x =(w-tw)/ 2:y =(" h/PHI)+ボックス= 1:[email protected] "、 " -c:vコピー "、 " outVideo.mp4 " }; – Sid

+0

-y -i input.mp4 -vf format = yuv444p -codec:v drawtext = text = 'このビデオのタイトル':fontcolor = white:fontsize = 24:x =(w-tw)/ 2:y =(h/PHI)+ thボックス= 1:[email protected] -c:vコピーoutVideo.mp4 – Sid

答えて

0

コマンドが不正です。 DrawTextは、フィルター、ないコーデックであるので、適切な場所に移動する必要がある:

ffmpeg -y -i input.mp4 -vf "format=yuv444p,drawtext=text='Title of this Video': fontcolor=white: fontsize=24: x=(w-tw)/2: y=(h/PHI)+th box=1: [email protected]" outVideo.mp4 
  • 私はそれを除去フィルタリングする際-c:v copyを使用することは不可能です。

  • 私はなぜformat=yuv444pを望んでいたのか分かりませんが、2つの線形フィルタを連鎖させる方法を示すために残しました。

+0

'fontcolor = white:'の適切な出力フォーマットが見つからない:fontcolor = white ::無効引数 – Sid

関連する問題