bravobit / FFmpeg-Android

FFMpeg/FFprobe compiled for Android
https://bravobit.nl/
MIT License
739 stars 175 forks source link

Two-Pass with libx264 #79

Open msroid opened 5 years ago

msroid commented 5 years ago

According to documentation for using this method we have to run ffmpeg twice like this:

Example:

ffmpeg -y -i input -c:v libx264 -b:v 2600k -pass 1 -an -f mp4 /dev/null && \
ffmpeg -i input -c:v libx264 -b:v 2600k -pass 2 -c:a aac -b:a 128k output.mp4

But I don't know how to run ffmpeg twice in android!

msroid commented 5 years ago

Nobody knows?!

stonyz commented 5 years ago
          ffmpeg.execute(command1, new ExecuteBinaryResponseHandler() {

                         @Override
            public void onSuccess(String s) {
                      ffmpeg.execute(command2, new ExecuteBinaryResponseHandler() {

                                                     @Override
                                          public void onSuccess(String s) {
                    //finished command 2
                                          }

                                  });
            }

         });

Like this.

msroid commented 5 years ago

Thanks for your help, I did exactly what you said but I got an error:

Unable to find a suitable output format for '&&'

as you see in the example the first command ends with: "/dev/null && \" but in android it doesn't know "&&" as an argument!

symphonyrecords commented 5 years ago

@msroid This is how you can use two-pass encoding #129