2

I have the same doubt that here. I want to execute this command on Android:

ffmpeg -i input.mp4 -s 480x320 output.mp4

So I compiled all the librarys with the NDK following this tutorial, I only need to add this code (I suppose that in a .c file that I have created) but I don´t know how... I will appreciate any help and any example if it was possible!!

2 Answers 2

1

You're probably looking for system or popen. There are plenty of existing questions on this topic.

Sign up to request clarification or add additional context in comments.

13 Comments

Thanks for answering. I´m trying to execute this command on Android so I don´t think these links will help me. I have a C file code and I know I must to write the ffmpeg operations there but I don´t know how (I´m a bit noob and I think I have a lot of gaps...) Please, read the point "2" of this link (roman10.net/…) and advise me what should I do...
When you're writing native C code for Android, you have access to the functions that I mentioned. If you're linking against the libffmpeg library, as suggested by the tutorial that you linked to, then you should be able to call functions in that library instead of executing ffmpeg as a shell command. In that case, I would suggest posting a separate (and reworded) question. Good luck!
Okey... I think I'm beginning to understand it... Thanks!!
hello @GonzaloSolera I am stucked at the same point since last two days. I compiled all the libraries for NDK and FFmpeg using this tutorial link . I even tested some small code for JNI which runs fine. Now I have to run commands like yours ffmpeg -i input.mp4 -s 480x320 output.mp4 All i can figure out is that if i create a .c class and do something in it i can get some result. However i cannot figure out how to execute single line command which everybody is talking about. Can you suggest me what approach shall i take. Thank You
Hi @aNoviceGuy, I know it's very confused, It took me so much time to find a solution. There are two ways to use FFmpeg on Android. The first is the way you're trying: compiling DINAMICALLY ffmpeg with the ndk. The problem is that if you use this way you can't use a command line, you need to need to use the JNI, etc. But the second way (that I'm using now because is very easy) is to compile STATICALLY FFmpeg. It means you will get only an executable file and you call it from your java files (not from a .c file). It´s very easy and I would recommend you to do that. I could link my ffmpeg file.
|
0

You are using this Command for FFmpeg4 library for better Video Quality and minimum Compression of Video in android. I have used in my project it's working successfully.

--> ffmpeg -i your input video path.mp4 -s 480x320 -acodec mp2 -strict -2 -ac 1 -ar 16000 -r 13 -ab 32000 -aspect 3:2 your output video path.mp4

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.