Anyone nterested on using FFMPEG inside own app?

DonManfred

Expert
Licensed User
Longtime User
Hello anyone,

i´m doing a wrapper for ffmpeg actually...

It seems to work but as i dont have worked with ffmep in the past i dont have some good commandline examples to convert a video to flv for example. Or to reduce the quality (videosize)...

So my question. Can someone provide some example commandlines to

- Convert a videofile to a much smaller one with lesser quality to reduce internet traffic when on the field...

As for now i´m trying the command
B4X:
ffmpg.executecommand(Array As String("-i",File.Combine(extsdcard,"DCIM/Camera/"&flist.Get(0))))

and it results in this output so far

** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
n2.4.2
DIRECTORY_ALARMS=Alarms
DIRECTORY_DCIM=DCIM
DIRECTORY_DOCUMENTS=Documents
DIRECTORY_DOWNLOADS=Download
DIRECTORY_MOVIES=Movies
DIRECTORY_MUSIC=Music
DIRECTORY_NOTIFICATIONS=Notifications
DIRECTORY_PICTURES=Pictures
DIRECTORY_PODCASTS=Podcasts
DIRECTORY_RINGTONES=Ringtones
DirRootExternal = /storage/emulated/0
extsdcard=/storage/emulated/0
lib:Raising.. ffmpeg_onstart()
** Activity (main) Resume **
** Service (overlay) Create **
** Service (overlay) Start **
FFMPEG_onStart
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
FFMPEG_onProgress(WARNING: linker: /data/data/b4a.example.ffmpeg/files/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.)
FFMPEG_onProgress(ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers)
FFMPEG_onProgress( built on Oct 7 2014 15:08:46 with gcc 4.8 (GCC))
FFMPEG_onProgress( configuration: --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/armeabi-v7a-neon --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -mfpu=neon' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=)
FFMPEG_onProgress( libavutil 54. 7.100 / 54. 7.100)
FFMPEG_onProgress( libavcodec 56. 1.100 / 56. 1.100)
FFMPEG_onProgress( libavformat 56. 4.101 / 56. 4.101)
FFMPEG_onProgress( libavdevice 56. 0.100 / 56. 0.100)
FFMPEG_onProgress( libavfilter 5. 1.100 / 5. 1.100)
FFMPEG_onProgress( libswscale 3. 0.100 / 3. 0.100)
FFMPEG_onProgress( libswresample 1. 1.100 / 1. 1.100)
FFMPEG_onProgress( libpostproc 53. 0.100 / 53. 0.100)
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onprogress()
lib:Raising.. ffmpeg_onfailure()
lib:Raising.. ffmpeg_onfinish()
FFMPEG_onProgress(Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/DCIM/Camera/20151018_131935.mp4':)
FFMPEG_onProgress( Metadata:)
FFMPEG_onProgress( major_brand : mp42)
FFMPEG_onProgress( minor_version : 0)
FFMPEG_onProgress( compatible_brands: isommp42)
FFMPEG_onProgress( creation_time : 2015-10-18 11:19:50)
FFMPEG_onProgress( Duration: 00:00:14.21, start: 0.000000, bitrate: 17230 kb/s)
FFMPEG_onProgress( Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 17016 kb/s, 29.99 fps, 30 tbr, 90k tbn, 180k tbc (default))
FFMPEG_onProgress( Metadata:)
FFMPEG_onProgress( rotate : 90)
FFMPEG_onProgress( creation_time : 2015-10-18 11:19:50)
FFMPEG_onProgress( handler_name : VideoHandle)
FFMPEG_onProgress( Side data:)
FFMPEG_onProgress( displaymatrix: rotation of -90.00 degrees)
FFMPEG_onProgress( Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default))
FFMPEG_onProgress( Metadata:)
FFMPEG_onProgress( creation_time : 2015-10-18 11:19:50)
FFMPEG_onProgress( handler_name : SoundHandle)
FFMPEG_onProgress(At least one output file must be specified)
FFMPEG_onFailure(WARNING: linker: /data/data/b4a.example.ffmpeg/files/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Oct 7 2014 15:08:46 with gcc 4.8 (GCC)
configuration: --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/armeabi-v7a-neon --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -mfpu=neon' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/DCIM/Camera/20151018_131935.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-10-18 11:19:50
Duration: 00:00:14.21, start: 0.000000, bitrate: 17230 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 17016 kb/s, 29.99 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2015-10-18 11:19:50
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
Metadata:
creation_time : 2015-10-18 11:19:50
handler_name : SoundHandle
At least one output file must be specified
)
FFMPEG_onFinish
** Activity (main) Pause, UserClosed = false **


So. If anyone could provide other example commandlines then i will try to use these commands with my videos to see it the library is working

Comments are highly welcome
 

DonManfred

Expert
Licensed User
Longtime User
The video source is 29,1mb mp4
The video destination is 1,1mb flv

Seems to work :D

B4X:
ffmpg.executecommand(Array As String("-i",File.Combine(extsdcard,"DCIM/Camera/"&flist.Get(0)),"-s","400x300","-b","512k","-async","50","-ar","11025","-ab","16k",File.Combine(File.DirRootExternal,"output_klein.flv")))

** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
n2.4.2
DIRECTORY_ALARMS=Alarms
DIRECTORY_DCIM=DCIM
DIRECTORY_DOCUMENTS=Documents
DIRECTORY_DOWNLOADS=Download
DIRECTORY_MOVIES=Movies
DIRECTORY_MUSIC=Music
DIRECTORY_NOTIFICATIONS=Notifications
DIRECTORY_PICTURES=Pictures
DIRECTORY_PODCASTS=Podcasts
DIRECTORY_RINGTONES=Ringtones
DirRootExternal = /storage/emulated/0
extsdcard=/storage/emulated/0
** Activity (main) Resume **
** Service (overlay) Create **
** Service (overlay) Start **
FFMPEG_onStart
FFMPEG_onProgress(WARNING: linker: /data/data/b4a.example.ffmpeg/files/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.)
FFMPEG_onProgress(ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers)
FFMPEG_onProgress( built on Oct 7 2014 15:08:46 with gcc 4.8 (GCC))
FFMPEG_onProgress( configuration: --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/armeabi-v7a-neon --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -mfpu=neon' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=)
FFMPEG_onProgress( libavutil 54. 7.100 / 54. 7.100)
FFMPEG_onProgress( libavcodec 56. 1.100 / 56. 1.100)
FFMPEG_onProgress( libavformat 56. 4.101 / 56. 4.101)
FFMPEG_onProgress( libavdevice 56. 0.100 / 56. 0.100)
FFMPEG_onProgress( libavfilter 5. 1.100 / 5. 1.100)
FFMPEG_onProgress( libswscale 3. 0.100 / 3. 0.100)
FFMPEG_onProgress( libswresample 1. 1.100 / 1. 1.100)
FFMPEG_onProgress( libpostproc 53. 0.100 / 53. 0.100)
FFMPEG_onProgress(Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/DCIM/Camera/20151018_131935.mp4':)
FFMPEG_onProgress( Metadata:)
FFMPEG_onProgress( major_brand : mp42)
FFMPEG_onProgress( minor_version : 0)
FFMPEG_onProgress( compatible_brands: isommp42)
FFMPEG_onProgress( creation_time : 2015-10-18 11:19:50)
FFMPEG_onProgress( Duration: 00:00:14.21, start: 0.000000, bitrate: 17230 kb/s)
FFMPEG_onProgress( Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 17016 kb/s, 29.99 fps, 30 tbr, 90k tbn, 180k tbc (default))
FFMPEG_onProgress( Metadata:)
FFMPEG_onProgress( rotate : 90)
FFMPEG_onProgress( creation_time : 2015-10-18 11:19:50)
FFMPEG_onProgress( handler_name : VideoHandle)
FFMPEG_onProgress( Side data:)
FFMPEG_onProgress( displaymatrix: rotation of -90.00 degrees)
FFMPEG_onProgress( Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default))
FFMPEG_onProgress( Metadata:)
FFMPEG_onProgress( creation_time : 2015-10-18 11:19:50)
FFMPEG_onProgress( handler_name : SoundHandle)
FFMPEG_onProgress(Please use -b:a or -b:v, -b is ambiguous)
FFMPEG_onProgress(-async is forwarded to lavfi similarly to -af aresample=async=50:min_hard_comp=0.100000:first_pts=0.)
FFMPEG_onProgress(Output #0, flv, to '/storage/emulated/0/output_klein.flv':)
FFMPEG_onProgress( Metadata:)
FFMPEG_onProgress( major_brand : mp42)
FFMPEG_onProgress( minor_version : 0)
FFMPEG_onProgress( compatible_brands: isommp42)
FFMPEG_onProgress( encoder : Lavf56.4.101)
FFMPEG_onProgress( Stream #0:0(eng): Video: flv1 (flv) ([2][0][0][0] / 0x0002), yuv420p, 400x300, q=2-31, 512 kb/s, 30 fps, 1k tbn, 30 tbc (default))
FFMPEG_onProgress( Metadata:)
FFMPEG_onProgress( rotate : 90)
FFMPEG_onProgress( creation_time : 2015-10-18 11:19:50)
FFMPEG_onProgress( handler_name : VideoHandle)
FFMPEG_onProgress( encoder : Lavc56.1.100 flv)
FFMPEG_onProgress( Stream #0:1(eng): Audio: adpcm_swf ([1][0][0][0] / 0x0001), 11025 Hz, stereo, s16, 88 kb/s (default))
FFMPEG_onProgress( Metadata:)
FFMPEG_onProgress( creation_time : 2015-10-18 11:19:50)
FFMPEG_onProgress( handler_name : SoundHandle)
FFMPEG_onProgress( encoder : Lavc56.1.100 adpcm_swf)
FFMPEG_onProgress(Stream mapping:)
FFMPEG_onProgress( Stream #0:0 -> #0:0 (h264 (native) -> flv1 (flv)))
FFMPEG_onProgress( Stream #0:1 -> #0:1 (aac (native) -> adpcm_swf (native)))
FFMPEG_onProgress(Press [q] to stop, [?] for help)
FFMPEG_onProgress(frame= 9 fps=0.0 q=4.6 size= 82kB time=00:00:01.02 bitrate= 655.2kbits/s )
FFMPEG_onProgress(frame= 22 fps= 20 q=8.2 size= 142kB time=00:00:01.02 bitrate=1135.2kbits/s )
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
FFMPEG_onProgress(frame= 33 fps= 20 q=9.0 size= 175kB time=00:00:02.04 bitrate= 703.2kbits/s )
FFMPEG_onProgress(frame= 46 fps= 21 q=8.8 size= 210kB time=00:00:02.04 bitrate= 840.2kbits/s )
FFMPEG_onProgress(frame= 59 fps= 22 q=9.2 size= 245kB time=00:00:03.01 bitrate= 665.5kbits/s )
FFMPEG_onProgress(frame= 75 fps= 24 q=11.1 size= 296kB time=00:00:03.01 bitrate= 804.2kbits/s )
FFMPEG_onProgress(frame= 89 fps= 24 q=10.9 size= 336kB time=00:00:04.04 bitrate= 681.0kbits/s )
FFMPEG_onProgress(frame= 105 fps= 25 q=12.4 size= 378kB time=00:00:04.04 bitrate= 766.5kbits/s )
FFMPEG_onProgress(frame= 118 fps= 25 q=9.2 size= 408kB time=00:00:04.78 bitrate= 698.5kbits/s )
FFMPEG_onProgress(frame= 135 fps= 26 q=9.2 size= 450kB time=00:00:05.01 bitrate= 735.6kbits/s )
FFMPEG_onProgress(frame= 149 fps= 26 q=8.6 size= 480kB time=00:00:05.29 bitrate= 743.3kbits/s )
FFMPEG_onProgress(frame= 164 fps= 26 q=8.5 size= 513kB time=00:00:06.03 bitrate= 695.7kbits/s )
FFMPEG_onProgress(frame= 180 fps= 27 q=10.8 size= 553kB time=00:00:06.03 bitrate= 749.8kbits/s )
FFMPEG_onProgress(frame= 194 fps= 27 q=9.5 size= 596kB time=00:00:07.05 bitrate= 691.4kbits/s )
FFMPEG_onProgress(frame= 210 fps= 27 q=8.7 size= 633kB time=00:00:07.05 bitrate= 734.0kbits/s )
FFMPEG_onProgress(frame= 224 fps= 27 q=8.8 size= 666kB time=00:00:08.03 bitrate= 678.6kbits/s )
FFMPEG_onProgress(frame= 240 fps= 27 q=8.5 size= 702kB time=00:00:08.03 bitrate= 716.2kbits/s )
FFMPEG_onProgress(frame= 254 fps= 27 q=8.9 size= 743kB time=00:00:09.05 bitrate= 672.1kbits/s )
FFMPEG_onProgress(frame= 270 fps= 27 q=8.8 size= 780kB time=00:00:09.05 bitrate= 705.6kbits/s )
FFMPEG_onProgress(frame= 284 fps= 27 q=8.5 size= 813kB time=00:00:10.03 bitrate= 664.2kbits/s )
FFMPEG_onProgress(frame= 300 fps= 28 q=8.5 size= 850kB time=00:00:10.03 bitrate= 694.0kbits/s )
FFMPEG_onProgress(frame= 314 fps= 28 q=8.7 size= 891kB time=00:00:11.05 bitrate= 660.0kbits/s )
FFMPEG_onProgress(frame= 328 fps= 28 q=8.5 size= 924kB time=00:00:11.05 bitrate= 684.8kbits/s )
FFMPEG_onProgress(frame= 340 fps= 27 q=8.5 size= 954kB time=00:00:12.02 bitrate= 650.0kbits/s )
FFMPEG_onProgress(frame= 354 fps= 27 q=8.3 size= 988kB time=00:00:12.02 bitrate= 673.0kbits/s )
FFMPEG_onProgress(frame= 366 fps= 27 q=8.3 size= 1018kB time=00:00:12.58 bitrate= 662.8kbits/s )
FFMPEG_onProgress(frame= 382 fps= 27 q=8.4 size= 1056kB time=00:00:13.05 bitrate= 663.0kbits/s )
FFMPEG_onProgress(frame= 397 fps= 27 q=6.9 size= 1083kB time=00:00:13.23 bitrate= 670.4kbits/s )
FFMPEG_onProgress(frame= 412 fps= 27 q=8.5 size= 1135kB time=00:00:14.07 bitrate= 660.5kbits/s )
FFMPEG_onProgress(frame= 425 fps= 27 q=8.6 Lsize= 1168kB time=00:00:14.21 bitrate= 673.0kbits/s )
FFMPEG_onProgress(video:1001kB audio:154kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.021180%)
FFMPEG_onSuccess(WARNING: linker: /data/data/b4a.example.ffmpeg/files/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Oct 7 2014 15:08:46 with gcc 4.8 (GCC)
configuration: --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/armeabi-v7a-neon --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -mfpu=neon' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/DCIM/Camera/20151018_131935.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-10-18 11:19:50
Duration: 00:00:14.21, start: 0.000000, bitrate: 17230 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 17016 kb/s, 29.99 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2015-10-18 11:19:50
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
Metadata:
creation_time : 2015-10-18 11:19:50
handler_name : SoundHandle
Please use -b:a or -b:v, -b is ambiguous
-async is forwarded to lavfi similarly to -af aresample=async=50:min_hard_comp=0.100000:first_pts=0.
Output #0, flv, to '/storage/emulated/0/output_klein.flv':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf56.4.101
Stream #0:0(eng): Video: flv1 (flv) ([2][0][0][0] / 0x0002), yuv420p, 400x300, q=2-31, 512 kb/s, 30 fps, 1k tbn, 30 tbc (default)
Metadata:
rotate : 90
creation_time : 2015-10-18 11:19:50
handler_name : VideoHandle
encoder : Lavc56.1.100 flv
Stream #0:1(eng): Audio: adpcm_swf ([1][0][0][0] / 0x0001), 11025 Hz, stereo, s16, 88 kb/s (default)
Metadata:
creation_time : 2015-10-18 11:19:50
handler_name : SoundHandle
encoder : Lavc56.1.100 adpcm_swf
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> flv1 (flv))
Stream #0:1 -> #0:1 (aac (native) -> adpcm_swf (native))
Press [q] to stop, [?] for help
frame= 9 fps=0.0 q=4.6 size= 82kB time=00:00:01.02 bitrate= 655.2kbits/s
frame= 22 fps= 20 q=8.2 size= 142kB time=00:00:01.02 bitrate=1135.2kbits/s
frame= 33 fps= 20 q=9.0 size= 175kB time=00:00:02.04 bitrate= 703.2kbits/s
frame= 46 fps= 21 q=8.8 size= 210kB time=00:00:02.04 bitrate= 840.2kbits/s
frame= 59 fps= 22 q=9.2 size= 245kB time=00:00:03.01 bitrate= 665.5kbits/s
frame= 75 fps= 24 q=11.1 size= 296kB time=00:00:03.01 bitrate= 804.2kbits/s
frame= 89 fps= 24 q=10.9 size= 336kB time=00:00:04.04 bitrate
Message longer than Log limit (4000). Message was truncated.
FFMPEG_onFinish
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
To whom who are interested:

The library is using a small .so which is the man-in-the-middle between b4a and the ffmpeg executeable which is in the Assets and are called from within the library.

I dont know if it will work on older devices. I´m using my device (a Samsung S6 EDGE) for the tests. Android Version on device is Lollipop (5.1)
 

DonManfred

Expert
Licensed User
Longtime User
Another test

B4X:
        '-an -ss 0:0:2 -t 0:0:0.001 -i input.mp4 -f image2 -s 110x90 thumb%d.jpg
        ffmpg.executecommand(Array As String("-an","-ss","0:0:2","-t","0:0:0.001","-i",File.Combine(extsdcard,"DCIM/Camera/"&flist.Get(0)),"-f","image2","-s","110x90",File.Combine(File.DirRootExternal,"thumb%d.jpg")))

This should create a thumbnail image...

thumb1.jpg


works :D
 

moster67

Expert
Licensed User
Longtime User
Very nice Don....now I don't need to do it :) Thank you.

It is good that you are using a small so-library. The so-library can be compiled according to which codecs, containers, protocol which you would like to support but the more you support, the bigger the so-files will become. See my FFmpeg_b4a wrapper I wrote some time ago for further information. Anyway, it would be nice when you have finished it if you could give a link later to the build and configuration process you used for compiling the so-library in case someone would like to enhance it or build one for different platforms (Arm, X86 etc).

I look forward to testing it.
 

DonManfred

Expert
Licensed User
Longtime User
It is good that you are using a small so-library.
No, i´m NOT doing a .so... The .so is available. The wrapper for b4a is 30kb jar and a few bytes of xml.
PLUS a 15mb ffmpeg executable inside the assets folder.

When i´m in the stage of beta testing i´ll send you a copy of it... For now it is nothing more than doing the wrappe and doing first steps in using it.
 

susu

Well-Known Member
Licensed User
Longtime User
I used ffmpeg to convert and stream video on my VPS, I think I can give you some commands. I'm using mobile so I will send you when I get my computer.
 

susu

Well-Known Member
Licensed User
Longtime User
Here some commands I used on CentOS, not sure it can be used in Android?

1. Save a stream into a file:
B4X:
ffmpeg -i http://www.example.com/playlist.m3u8 -vcodec copy -c:a aac -strict -2 -ar 44100 -ab 48k video.mp4

2. Save a stream into a file with subtitile:
B4X:
ffmpeg -i http://www.example.com/playlist.m3u8 -vcodec libx264 -c:a aac -strict -2 -ar 44100 -ab 48k -vf subtitles=subtitle.srt video.mp4

3. Add watermark into video:
B4X:
ffmpeg -i source.mp4 -vf "movie=/folder/logo.png [watermark]; [in][watermark] overlay=0:0 [out]" -vcodec libx264 -acodec copy -f mp4 video.mp4

4. Convert mp4 to webm format:
B4X:
ffmpeg -i source.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis video.webm

5. Convert mp4 to gif (from 00:00:02 and 5 seconds long):
B4X:
ffmpeg -t 5 -ss 00:00:02 -i video.mp4 clip.gif

6. Convert gif to mp4:
B4X:
ffmpeg -f gif -i clip.gif video.mp4
 

susu

Well-Known Member
Licensed User
Longtime User
@DonManfred , can your FFMPEG lib play streaming video? If yes, it will be the most powerful video player.
 

DonManfred

Expert
Licensed User
Longtime User
can your FFMPEG lib play streaming video?
No. you can see the lib as a kind of starter for the ffmpeg executable (cli).
Maybe it is possible to save a stream to a video. i did not tested susus sample commandlines.

I just tried the commandline to add an overlay to a video but it seems i cant get it to work.
Maybe the ffmpeg is doing something in backgroud.. but i dont get any progress as yet. Aehm... It started output but stopped at a line i did not expect the end of output. Maybe one or more of the parameter i did not send correctly
 
Top