Closed FranciscoNin closed 6 years ago
I am not able to reproduce this. Can you please tell me the values of MediaUtils.getBitrateFromVideoResolution(context, path)
SystemUtils.getNumberOfCores()
And possibly the video you are actually trying to compress?
Do you see any error message in logcat?
Thanks for the quick response!
The bitrate used is 1M and the number of cores is 2.
The video I tested: test_compress.mp4.zip
I don't see any error messages in the logcat
@madhavanmalolan : Getting the same issue, I started the video compressing but nothing is happening.
The video was about 3.5mb. This is the command i used,
val complexCommand = arrayOf<String>("-y", "-i", filePath!!, "-strict", "experimental", "-vcodec", "libx264", "-preset", "ultrafast", "-crf", "24", "-acodec", "aac", "-ar", "44100", "-ac", "2", "-b:a", "96k", "-s", "320x240", "-aspect", "4:3", outputFile)
Controller.getInstance().run(complexCommand)
Its working with your command in exmaple.
Can you please check or guide me through the command of compression of the video?
Have either of you @FranciscoNin @HardikChauhanSA found a solution to this? I have not been able to debug this issue :disappointed:
I used to compress the video process with the below comments, it works for up to Nougat 7.0 (API level 24), Latest Android versions stopped working. (Versions are Oreo | 8.1.0 | API level 27 Oreo | 8.0.0 | API level 26 Nougat | 7.1 | API level 25 )
Package Name: Xamarin.Android.FFmpeg Version: 1.0.32
string[] cmds = new string[] { "-y", "-i", inputFilepath, "-strict", "experimental", "-vcodec", "libx264", "-preset", "ultrafast", "-crf","30", "-acodec","aac", "-ar", "44100" , "-q:v", "20", "-vf", "mp=eq2=1:1.68:0.3:1.25:1:0.96:1", ouputFile, };
string cmdParams = string.Join(" ", cmds);
FFMpeg.Xamarin.FFMpegLibrary.Run(Xamarin.Forms.Forms.Context, cmdParams, loggerAction);
Can you please help me on this issue?
@madhavanmalolan I gave up and used the ffmpeg4android library, but even by tweaking every possible command combination I wasn't able to compress in less than 30 seconds for a 3 seconds video. What I made was to make my own camera in app so I would record only videos in a lower resolution with a max size of 22mb (in a 1min video), so I wouldn't need to compress it before sending to the server.
@FranciscoNin Having the same issue. Thanks for the sharing your notes. Is your custom camera support to latest Android OS 9.0 Pie? Do you have sample code on GitHub as open source? can you share me that link that would be helpful?
@khetiyachintan sure, I did that recently on an issue from the ffmpeg library for Android. There I explained what I tried to achieve with that library and what I ended up doing with a custom camera view.
Here: https://github.com/WritingMinds/ffmpeg-android-java/issues/265#issuecomment-441251261
Hope it helps. If there's anything else I can do to help, please let me know.
Cheers
Hi!
I'm trying to compress videos with your library, and at first the app was crashing, but after I read through some of the closed issues it's not crashing anymore, but it's also not working to compress the video.
That's how I'm trying to do it:
Controller.getInstance().run(MediaUtils.getCompressCommand(path, activity, newFileName));
public static String[] getCompressCommand(String path, Context context, String newFileName) { return new String[]{"-y", "-i", path, "-s", "640x480", "-b:v", MediaUtils.getBitrateFromVideoResolution(context, path), "-strict", "-2", "-c:v", "libx264", "-preset", "ultrafast", "-crf", "18", "-c:a", "aac", "-threads", String.valueOf(SystemUtils.getNumberOfCores()), "-ac", "2", "-ar", "44100", "-b:a", "128k", "-f", "mp4", newFileName}; }