Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
FFMpeg Android : libvideokit.so library failed to load
7 décembre 2015, par mhl1291I am Working on taking a picture from video I am using FFMpeg Library downloaded from here
It Works Perfectly but in some device i got the message "libvideokit.so load Fail" and then crash the application any solution for this?
Thanking you in advance
-
FFMPEG 2.5.4 build for Android with NDK r10d
7 décembre 2015, par jmartinalonsoI'm trying to build FFmpeg for android following this tuto: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
I'm using:
- NDK r10d
- FFMPEG 2.5.4
I have tried to build on MacOs and Ubuntu and I get the same error when I execute ./build_android.sh:
`Creating config.mak, config.h, and doc/config.texi... ./build_android.sh: line 16: --prefix=/Users/jesusmartin92/Documents/android-ndk-r10d/sources/ffmpeg-2.5.4/android/arm: No such file or directory ./build_android.sh: line 18: --enable-shared: command not found ./build_android.sh: line 20: --disable-static: command not found ./build_android.sh: line 22: --disable-doc: command not found ./build_android.sh: line 24: --disable-ffmpeg: command not found ./build_android.sh: line 26: --disable-ffplay: command not found ./build_android.sh: line 28: --disable-ffprobe: command not found ./build_android.sh: line 30: --disable-ffserver: command not found ./build_android.sh: line 32: --disable-avdevice: command not found ./build_android.sh: line 34: --disable-doc: command not found ./build_android.sh: line 36: --disable-symver: command not found ./build_android.sh: line 38: --cross-prefix=/Users/jesusmartin92/Documents/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-: No such file or directory ./build_android.sh: line 40: --target-os=linux: command not found ./build_android.sh: line 42: --arch=arm: command not found ./build_android.sh: line 44: --enable-cross-compile: command not found ./build_android.sh: line 46: --sysroot=/Users/jesusmartin92/Documents/android-ndk-r10d/platforms/android-9/arch-arm/: No such file or directory ./build_android.sh: line 48: --extra-cflags=-Os -fpic -marm: command not found ./build_android.sh: line 50: --extra-ldflags=: command not found`
It's like the script doesn't find the ndk folder, but I checked and the path is OK. The script "build_android.sh" is in the ffmpeg folder. This is the content of it:
#!/bin/bash NDK=/Users/jesusmartin92/Documents/android-ndk-r10d SYSROOT=$NDK/platforms/android-9/arch-arm/ TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64 function build_one { ./configure \ --prefix=$PREFIX \ --enable-shared \ --disable-static \ --disable-doc \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --disable-avdevice \ --disable-doc \ --disable-symver \ --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \ --target-os=linux \ --arch=arm \ --enable-cross-compile \ --sysroot=$SYSROOT \ --extra-cflags="-Os -fpic $ADDI_CFLAGS" \ --extra-ldflags="$ADDI_LDFLAGS" \ $ADDITIONAL_CONFIGURE_FLAG make clean make make install } CPU=arm PREFIX=$(pwd)/android/$CPU ADDI_CFLAGS="-marm" build_one
I'm very stuck, so any idea will be well received.
Thanks
-
How to convert any video type to .mp4 using phpvideotoolkit
7 décembre 2015, par user3653474I am following this http://www.phpclasses.org/package/3747-PHP-Manipulate-and-convert-videos-with-ffmpeg-program.html link to convert any video type to .mp4 i tried to run various example files but they are throwing error message. I can't get how to convert the file using phpvideotoolkit.
If i run the following file http://localhost/phpvideotoolkit-v2-master/examples/convert-to-multiple-outputs.php i get this error.
An error was encountered with FFmpeg when attempting to read the formats that FFmpeg supports. FFmpeg reported: The system cannot find the path specified. PHPVideoToolkit\FfmpegProcessException Object ( [process:protected] => PHPVideoToolkit\FfmpegProcess Object ( [_exec:protected] => PHPVideoToolkit\ExecBuffer Object ( [_failure_tracking:protected] => 1 [_blocking:protected] => 1 [_output:protected] => [_temp_directory:protected] => C:\wamp\www\phpvideotoolkit-v2-master\examples\tmp [_executed_command:protected] => ((/opt/local/bin/ffmpeg "-formats" && echo ^) || echo ^ ^ ^) 2>&1 > "C:\wamp\www\phpvideotoolkit-v2-master\examples\tmp\php5359.tmp" 2>&1 & [_command:protected] => /opt/local/bin/ffmpeg "-formats" [_buffer:protected] => The system cannot find the path specified. [_error_code:protected] => 0 [_running:protected] => [_start_time:protected] => 1449479003.9261 [_end_time:protected] => 1449479003.9841 [_callback_period_interval:protected] => 1 [_boundary:protected] => 749429-56654b5be19a9-f741fa350232252bd14d9abb334a7e6e [_failure_boundary:protected] => [_completion_boundary:protected] => [_error_code_boundary:protected] => [_php_exec_infinite_timelimit:protected] => 1 [_tmp_files:protected] => Array ( [0] => C:\wamp\www\phpvideotoolkit-v2-master\examples\tmp\php5359.tmp ) [_gc_temp_files:protected] => 1 [_completion_callbacks:protected] => Array ( ) ) [_pre_input_commands:protected] => Array ( ) [_input:protected] => Array ( ) [_output_index:protected] => 0 [_post_input_commands:protected] => Array ( [0] => Array ( [-formats] => ) ) [_output:protected] => Array ( ) [_post_output_commands:protected] => Array ( ) [_progress_handler:protected] => [_combined:protected] => 1 [_program_path:protected] => /opt/local/bin/ffmpeg [_arguments:protected] => Array ( [0] => -formats ) [_config] => PHPVideoToolkit\Config Object ( [_ffmpeg:protected] => /opt/local/bin/ffmpeg [_ffprobe:protected] => /opt/local/bin/ffprobe [_yamdi:protected] => /opt/local/bin/yamdi [_qtfaststart:protected] => /opt/local/bin/qt-faststart [_temp_directory:protected] => C:\wamp\www\phpvideotoolkit-v2-master\examples\tmp [_gif_transcoder:protected] => php [_gif_transcoder_convert_use_dither:protected] => [_gif_transcoder_convert_dither_order:protected] => o8x8,8 [_gif_transcoder_convert_use_coalesce:protected] => [_gif_transcoder_convert_use_map:protected] => [_gifsicle:protected] => /opt/local/bin/gifsicle [_convert:protected] => /opt/local/bin/convert [_php_exec_infinite_timelimit:protected] => 1 [_force_enable_qtfaststart:protected] => [_force_enable_flv_meta:protected] => 1 [_cache_driver:protected] => InTempDirectory [_set_default_output_format:protected] => 1 ) ) [exec:protected] => [message:protected] => An error was encountered with FFmpeg when attempting to read the formats that FFmpeg supports. FFmpeg reported: The system cannot find the path specified. [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\Parser.php [line:protected] => 99 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\FfmpegParser.php [line] => 51 [function] => getRawFormatData [class] => PHPVideoToolkit\Parser [type] => -> [args] => Array ( ) ) [1] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\FfmpegParser.php [line] => 78 [function] => _getParser [class] => PHPVideoToolkit\FfmpegParser [type] => -> [args] => Array ( ) ) [2] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\Format.php [line] => 122 [function] => __call [class] => PHPVideoToolkit\FfmpegParser [type] => -> [args] => Array ( [0] => getCommands [1] => Array ( ) ) ) [3] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\Format.php [line] => 122 [function] => getCommands [class] => PHPVideoToolkit\FfmpegParser [type] => -> [args] => Array ( ) ) [4] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\AudioFormat.php [line] => 52 [function] => __construct [class] => PHPVideoToolkit\Format [type] => -> [args] => Array ( [0] => input [1] => PHPVideoToolkit\Config Object ( [_ffmpeg:protected] => /opt/local/bin/ffmpeg [_ffprobe:protected] => /opt/local/bin/ffprobe [_yamdi:protected] => /opt/local/bin/yamdi [_qtfaststart:protected] => /opt/local/bin/qt-faststart [_temp_directory:protected] => C:\wamp\www\phpvideotoolkit-v2-master\examples\tmp [_gif_transcoder:protected] => php [_gif_transcoder_convert_use_dither:protected] => [_gif_transcoder_convert_dither_order:protected] => o8x8,8 [_gif_transcoder_convert_use_coalesce:protected] => [_gif_transcoder_convert_use_map:protected] => [_gifsicle:protected] => /opt/local/bin/gifsicle [_convert:protected] => /opt/local/bin/convert [_php_exec_infinite_timelimit:protected] => 1 [_force_enable_qtfaststart:protected] => [_force_enable_flv_meta:protected] => 1 [_cache_driver:protected] => InTempDirectory [_set_default_output_format:protected] => 1 ) ) ) [5] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\VideoFormat.php [line] => 61 [function] => __construct [class] => PHPVideoToolkit\AudioFormat [type] => -> [args] => Array ( [0] => input [1] => PHPVideoToolkit\Config Object ( [_ffmpeg:protected] => /opt/local/bin/ffmpeg [_ffprobe:protected] => /opt/local/bin/ffprobe [_yamdi:protected] => /opt/local/bin/yamdi [_qtfaststart:protected] => /opt/local/bin/qt-faststart [_temp_directory:protected] => C:\wamp\www\phpvideotoolkit-v2-master\examples\tmp [_gif_transcoder:protected] => php [_gif_transcoder_convert_use_dither:protected] => [_gif_transcoder_convert_dither_order:protected] => o8x8,8 [_gif_transcoder_convert_use_coalesce:protected] => [_gif_transcoder_convert_use_map:protected] => [_gifsicle:protected] => /opt/local/bin/gifsicle [_convert:protected] => /opt/local/bin/convert [_php_exec_infinite_timelimit:protected] => 1 [_force_enable_qtfaststart:protected] => [_force_enable_flv_meta:protected] => 1 [_cache_driver:protected] => InTempDirectory [_set_default_output_format:protected] => 1 ) ) ) [6] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\Media.php [line] => 226 [function] => __construct [class] => PHPVideoToolkit\VideoFormat [type] => -> [args] => Array ( [0] => input [1] => PHPVideoToolkit\Config Object ( [_ffmpeg:protected] => /opt/local/bin/ffmpeg [_ffprobe:protected] => /opt/local/bin/ffprobe [_yamdi:protected] => /opt/local/bin/yamdi [_qtfaststart:protected] => /opt/local/bin/qt-faststart [_temp_directory:protected] => C:\wamp\www\phpvideotoolkit-v2-master\examples\tmp [_gif_transcoder:protected] => php [_gif_transcoder_convert_use_dither:protected] => [_gif_transcoder_convert_dither_order:protected] => o8x8,8 [_gif_transcoder_convert_use_coalesce:protected] => [_gif_transcoder_convert_use_map:protected] => [_gifsicle:protected] => /opt/local/bin/gifsicle [_convert:protected] => /opt/local/bin/convert [_php_exec_infinite_timelimit:protected] => 1 [_force_enable_qtfaststart:protected] => [_force_enable_flv_meta:protected] => 1 [_cache_driver:protected] => InTempDirectory [_set_default_output_format:protected] => 1 ) ) ) [7] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\Media.php [line] => 188 [function] => _getDefaultFormat [class] => PHPVideoToolkit\Media [type] => -> [args] => Array ( [0] => input [1] => VideoFormat [2] => ) ) [8] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\Media.php [line] => 150 [function] => getDefaultFormat [class] => PHPVideoToolkit\Media [type] => -> [args] => Array ( [0] => input [1] => mp4 ) ) [9] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\Media.php [line] => 78 [function] => setInputFormat [class] => PHPVideoToolkit\Media [type] => -> [args] => Array ( [0] => ) ) [10] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\Video.php [line] => 35 [function] => __construct [class] => PHPVideoToolkit\Media [type] => -> [args] => Array ( [0] => C:\wamp\www\phpvideotoolkit-v2-master\examples/media/BigBuckBunny_320x180.mp4 [1] => [2] => ) ) [11] => Array ( [file] => C:\wamp\www\phpvideotoolkit-v2-master\examples\convert-to-3gp.php [line] => 9 [function] => __construct [class] => PHPVideoToolkit\Video [type] => -> [args] => Array ( [0] => C:\wamp\www\phpvideotoolkit-v2-master\examples/media/BigBuckBunny_320x180.mp4 ) ) ) [previous:Exception:private] => [xdebug_message] =>
( ! ) PHPVideoToolkit\FfmpegProcessException: An error was encountered with FFmpeg when attempting to read the formats that FFmpeg supports. FFmpeg reported: The system cannot find the path specified. in C:\wamp\www\phpvideotoolkit-v2-master\src\PHPVideoToolkit\Parser.php on line 99 Call Stack # Time Memory Function Location 1 0.0020 259704 {main}( ) ..\convert-to-3gp.php:0 2 0.0420 1089432 PHPVideoToolkit\Video->__construct( ) ..\convert-to-3gp.php:9 3 0.0420 1089912 PHPVideoToolkit\Media->__construct( ) ..\Video.php:35 4 0.0510 1099872 PHPVideoToolkit\Media->setInputFormat( ) ..\Media.php:78 5 0.0670 1385064 PHPVideoToolkit\Media->getDefaultFormat( ) ..\Media.php:150 6 0.0670 1385368 PHPVideoToolkit\Media->_getDefaultFormat( ) ..\Media.php:188 7 0.0780 1692632 PHPVideoToolkit\VideoFormat->__construct( ) ..\Media.php:226 8 0.0780 1692864 PHPVideoToolkit\AudioFormat->__construct( ) ..\VideoFormat.php:61 9 0.0780 1693192 PHPVideoToolkit\Format->__construct( ) ..\AudioFormat.php:52 10 0.0780 1694784 getCommands ( ) ..\Format.php:122 11 0.0780 1695080 PHPVideoToolkit\FfmpegParser->__call( ) ..\Format.php:122 12 0.0780 1695248 PHPVideoToolkit\FfmpegParser->_getParser( ) ..\FfmpegParser.php:78 )13 0.0810 1696512 PHPVideoToolkit\Parser->getRawFormatData( ) ..\FfmpegParser.php:51 -
Transcoding via FFmpeg. Set starting pcr value
7 décembre 2015, par Ivan KolesnikovI transcoding via FFmpeg (video codec - h264, container - MPEG-TS) output writing to local file (out.mpg). When FFmpeg dropped I restarted it with output to the same file (out.mpg). After this my video player shows incorrect file duration due to new FFmpeg process start counting PCR from 0.
Can I set starting pcr value at start FFmpeg ? -
Android : FFmpegFrameRecorder (JavaCV) UnsatisfiedLinkError
7 décembre 2015, par Olcay ErtaşI am trying to record video using
OpenCV
with some overlayed data. I have addedOpenCV
to my project and get camera preview successfully. While searching for how can I record video I came across toJavaCV
.JavaCV
has a sapmle activity calledRecordActivity
to demostrate video recording. It adds aCameraView
dynamically with code and get camera frames and record them inonPreviewFrame
method of theCameraView
. You can see the full code here:What I want to do is record video in
onCameraFrame
metod of theCvCameraViewListener2
interface instead ofonPreviewFrame
metod of thePreviewCallback
.public Mat onCameraFrame(CvCameraViewFrame inputFrame) { final Mat rgba = inputFrame.rgba(); Core.flip(rgba, rgba, 1); // Overlay some text and record video here. return rgba; }
JavaCV record code block from RecordAvtivity.java
public void onPreviewFrame(byte[] data, Camera camera) { if (audioRecord == null || audioRecord.getRecordingState() != AudioRecord.RECORDSTATE_RECORDING) { startTime = System.currentTimeMillis(); return; } int i = imagesIndex++ % images.length; Frame yuvImage = images[i]; timestamps[i] = 1000 * (System.currentTimeMillis() - startTime); /* get video data */ if (yuvImage != null && recording) { ((ByteBuffer) yuvImage.image[0].position(0)).put(data); try { Log.v(TAG, "Writing Frame"); long t = 1000 * (System.currentTimeMillis() - startTime); if (t > recorder.getTimestamp()) { recorder.setTimestamp(t); } recorder.record(yuvImage); } catch (FFmpegFrameRecorder.Exception e) { Log.v(TAG, e.getMessage()); e.printStackTrace(); } } }
JavaCV
needs data asbyte[]
but I haveMat
object. I need to cenvert between them efficiently.How can I do that?
UPDATE:
I have used following solution to solve my initial problem
public Mat onCameraFrame(CvCameraViewFrame inputFrame) { final Mat rgba = inputFrame.rgba(); Core.flip(rgba, rgba, 1); if (data == null) { data = new byte[(int)rgba.total() * rgba.channels()]; } rgba.get(0,0, data); record(data); return rgba; } public void record(byte[] data) { if (audioRecord == null || audioRecord.getRecordingState() != AudioRecord.RECORDSTATE_RECORDING) { startTime = System.currentTimeMillis(); return; } int i = imagesIndex++ % images.length; Frame yuvImage = images[i]; timestamps[i] = 1000 * (System.currentTimeMillis() - startTime); /* get video data */ if (yuvImage != null && recording) { ((ByteBuffer) yuvImage.image[0].position(0)).put(data); try { Log.v(TAG, "Writing Frame"); long t = 1000 * (System.currentTimeMillis() - startTime); if (t > recorder.getTimestamp()) { recorder.setTimestamp(t); } recorder.record(yuvImage); } catch (FFmpegFrameRecorder.Exception e) { Log.v(TAG, e.getMessage()); e.printStackTrace(); } } }
but now I am getting following error:
FATAL EXCEPTION: main E/AndroidRuntime: Process: com.yceo.anlatbana, PID: 17622 E/AndroidRuntime: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil E/AndroidRuntime: at java.lang.Class.classForName(Native Method) E/AndroidRuntime: at java.lang.Class.forName(Class.java:309) E/AndroidRuntime: at org.bytedeco.javacpp.Loader.load(Loader.java:390) E/AndroidRuntime: at org.bytedeco.javacpp.Loader.load(Loader.java:358) E/AndroidRuntime: at org.bytedeco.javacpp.avcodec$AVPacket.
(avcodec.java:1407) E/AndroidRuntime: at org.bytedeco.javacv.FFmpegFrameRecorder. (FFmpegFrameRecorder.java:149) E/AndroidRuntime: at com.yceo.anlatbana.GameFragment.initRecorder(GameFragment.java:267) E/AndroidRuntime: at com.yceo.anlatbana.GameFragment.onCreate(GameFragment.java:98) E/AndroidRuntime: at android.support.v4.app.Fragment.performCreate(Fragment.java:1939) E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:988) E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1207) E/AndroidRuntime: at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738) E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1572) E/AndroidRuntime: at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:493) E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739) E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95) E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135) E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5310) E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372) E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904) E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699) I have tried solution from below question but it didn't work:
JavaCV configuration in Android Studio
I have also tried both manual and gradle install for JavaCV but none of them worked.
I am using:
- Android Studio 1.4
- OpenCV 3.0
- JavaCV 1.0