forked from guardianproject/android-ffmpeg
-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.txt
114 lines (87 loc) · 4.52 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
===new in this fork
- android jni in videokit
- android app as controller for ffmpeg
- media selection by android app for media files that get muxed
sample logcat at : http://pastebin.com/SHtc2ppU
I liked the newer log implementation , esp in ./ffmpeg/cmdutils.c in the
'guardian' project. But , i also needed the java layer, jni integration, and
the 'videokit' directory and library from 'halfninja' version of 'android-ffmpeg'.
Halfninja, in ./Project/jni/videokit/cmdutils.c ffmpeg.c solved some issues
with sysexit and with wierd fprintf vs av_log issue that is no longer
relevant in the current ffmpeg release. Native logger is fine and ,
you can see it in android logcat by redirecting (stdout, stderr)
to logcat. That means that jni android stuff can link directly against
the current version of ffmpeg.c and the current version of cmdutils.c.
Note this linking strategy screws up the app's android lifecycle because
jni interface cant handle the 'exit-program()' at the end of the main function
in ./jni/ffmpeg/ffmpeg.c. See Halfninja on git for solution to the sysexit issue.
So, i merged the most useful , jni related stuff from halfninja/
into guardian and then added code of mine :
buttons in the main Android activity w/ binding to following features:
-select a picture
-start a recording ( you talk about the picture
-stop recording ( sound track persists to a .3gp codec=amrnb
-mux creates a video using the selected picture and the audio recording
mux output (container=3gp, audio=amrnb, video=mpeg4
setup
-----
same NDK
edit ./Project/jni/settings.sh to conform with your NDK setup, NDK_Base etc.
edit ./Project/local.properties setting home dirs for SDK, NDK
edit ./Project/project.properties setting the android api you will use
./Project dir android update using below : exec cmd from project root dir
$ android update project --target 1 --name RecorderActivity --path Project
edit & reset the AndroidManifest.xml file to what u are using
edit / review cpu setting in ./Project/jni/configure_ffmpeg.sh
building
-------
same 2 steps for the submodules ( i moved them ,but they need 'init' and 'update'
submodules install to ./ffmpeg dir and to ./x264 dir under ./Project/jni
cd Project/jni
./configure_make_everything.sh
$NDK/ndk-build
cd ./Project
./ant debug
output of above will be the apk file in the ./bin directory
install the apk
redirect stderr to android logcat so u can see all the stdout/ stderr msgs from ffmpeg
$ adb shell setprop log.redirect-stdio true
test the apk looking at logcat stmts from ffmpeg ... lots of them
if u have root ...
adb push the /libs/armv7-a/ffmpeg executable to /data/local/tmp/ffmpeg.
get a shell on the phone. run ffmpeg CLI expressions right there.
with CLI, u may try out lots of possible permutations of the ffmpeg switches
when u get a set of switch values that u like , plug them into the java
file at ./RecorderActivity.java and the java interface will mimic the transform
that you have tested on the CLI in the shell on the phone.
=== pre fork notes from guardian version
This is a new android-ffmpeg project since it seems there were so many
different ways of doing it, it was confusing. So here is my clean, easily
changeable, static ffmpeg creator for Android. The result is a single
'ffmpeg' that is statically linked, so its the only file you need.
setup
-----
1. Install the Android NDK
2. On Debian/Ubuntu, run: apt-get install yasm bash patch make
building
--------
cd android-ffmpeg
git submodule init
git submodule update
NDK_BASE=/path/to/android-ndk ./configure_make_everything.sh
That should give you command line binary ffmpeg/ffmpeg, which is the only file
you should need.
customizing
-----------
If you want to change which coders, decoders, muxers, filters, etc that are
included, edit configure_ffmpeg.sh and add/substract what you want.
sources of inspiration
----------------------
https://github.com/mconf/android-ffmpeg
https://github.com/halfninja/android-ffmpeg-x264
https://github.com/guardianproject/SSCVideoProto
http://wiki.multimedia.cx/index.php?title=FFmpeg_filter_howto
testing
-------
./ffmpeg -f lavfi -i "movie=midr-mjpeg.mov,redact=redact_unsort.txt" -f lavfi -i "amovie=midr-mjpeg.mov,aredact=aredact_unsort.txt" -acodec copy -vcodec copy -y /tmp/output.mov
./ffmpeg -f lavfi -i "movie=../testfiles/sscvideoproto_nexuss_high_quality_2_3_3.mp4,redact=redact_unsort.txt" -f lavfi -i "amovie=../testfiles/sscvideoproto_nexuss_high_quality_2_3_3.mp4,aredact=aredact_unsort.txt" -acodec copy -vcodec libx264 -b:v 1000k -an -f mp4 -y /tmp/output.mp4