
Recherche avancée
Autres articles (58)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)
Sur d’autres sites (5500)
-
Scale overlay image FFMPEG
6 juillet 2015, par VickySI have 3 inputs— a background image, a text file containing list of image file location (to overlay on background image), and an audio file (to be played in background).
I need to scale the overlay images from "images.txt".
I am using below command.
I dont know what am I doing wrong.command: ffmpeg -loop 1 -i /sdcard/emoj/angry_bg.png -r 21.0 -f concat -i /sdcard/emoj/images.txt -i /sdcard/emoj/final.wav -filter_complex [1]scale=320:240 [ovrl],[0][ovrl] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2 -shortest -s 1080x1920 -b:v 320k -codec:v h264 -c:v mpeg4 -c:a aac -strict experimental -b:a 32k /sdcard/emoj/myPetVideo.mp4
Please give suggestions.
Logcat Output :
07-06 04:13:38.525: I/ffmpeg4android(28481): Command is set
07-06 04:13:38.525: I/ffmpeg4android(28481): set remoteNotificationIconId: 0
07-06 04:13:38.535: D/ffmpeg4android(28481): Client Cannot unbind - service not bound
07-06 04:13:38.535: D/ffmpeg4android(28481): Client stopService()
07-06 04:13:38.545: W/ContextImpl(28481): Implicit intents with startService are not safe: Intent { act=com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge } android.content.ContextWrapper.stopService:520 com.netcompss.ffmpeg4android_client.BaseWizard.stopService:495 com.netcompss.ffmpeg4android_client.BaseWizard.runTranscoing:279
07-06 04:13:38.555: I/ffmpeg4android(28481): !!!!!!!!!!!!!!!!!!services.size(): 1
07-06 04:13:38.555: I/ffmpeg4android(28481): putting Base categoty
07-06 04:13:38.615: D/ffmpeg4android(28481): started: com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge
07-06 04:13:38.615: D/ffmpeg4android(28481): Client startService()
07-06 04:13:38.615: D/ffmpeg4android(28481): bindService() called
07-06 04:13:38.615: W/ContextImpl(28481): Implicit intents with startService are not safe: Intent { act=com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge } android.content.ContextWrapper.bindService:538 com.netcompss.ffmpeg4android_client.BaseWizard.bindService:506 com.netcompss.ffmpeg4android_client.BaseWizard.runTranscoing:282
07-06 04:13:38.625: D/ffmpeg4android(28481): Client bindService()
07-06 04:13:38.725: I/ffmpeg4android(28620): =======service onCreate(): Stopping forground (to overcome 2.3.x bug)
07-06 04:13:38.725: I/ffmpeg4android(28620): =======service onBind()=======
07-06 04:13:38.735: I/ffmpeg4android(28620): ===onStartCommand called
07-06 04:13:38.735: D/ffmpeg4android(28481): Client onServiceConnected()
07-06 04:13:38.735: E/ffmpeg4android(28481): invokeService called
07-06 04:13:38.735: E/rc......(28481): 1
07-06 04:13:38.735: I/ffmpeg4android(28481): setting remote notification info
07-06 04:13:38.735: D/ffmpeg4android(28620): command items num: 33
07-06 04:13:38.735: D/ffmpeg4android(28620): command: ffmpeg -loop 1 -i /sdcard/emoj/angry_bg.png -r 21.0 -f concat -i /sdcard/emoj/images.txt -i /sdcard/emoj/final.wav -filter_complex [1]scale=320:240 [ovrl],[0][ovrl] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2 -shortest -s 1080x1920 -b:v 320k -codec:v h264 -c:v mpeg4 -c:a aac -strict experimental -b:a 32k /sdcard/emoj/myPetVideo.mp4
07-06 04:13:38.745: D/ffmpeg4android(28620): workingFolder from remote: /sdcard/emoj
07-06 04:13:38.745: D/ffmpeg4android(28481): deleteing: /sdcard/emoj/vk.log isdeleted: true
07-06 04:13:38.745: D/ffmpeg4android(28481): deleteing: /sdcard/emoj/ffmpeg4android.log isdeleted: false
07-06 04:13:38.745: D/ffmpeg4android(28481): deleteing: /sdcard/emoj/videokit.log isdeleted: true
07-06 04:13:38.745: D/ffmpeg4android(28481): Client invokeService()
07-06 04:13:38.755: I/ffmpeg4android(28620): ===onStartCommand cat: Base
07-06 04:13:38.755: D/ffmpeg4android(28620): onStartCommand, START_STICKY, base Command
07-06 04:13:38.755: D/ffmpeg4android(28481): Acquire wake lock
07-06 04:13:38.765: D/ffmpeg4android(28481): TranscodeBackground doInBackground started
07-06 04:13:38.765: I/ffmpeg4android(28620): =======remote service runTranscoding ======
07-06 04:13:38.775: I/ffmpeg4android(28620): Start RemoteService with notification id: 5326
07-06 04:13:38.785: I/ffmpeg4android(28620): Run called.
07-06 04:13:38.785: I/ffmpeg4android(28620): ===============Running command from thread path: /sdcard/emoj
07-06 04:13:38.785: I/ffmpeg4android(28620): videokitLibPath: /data/data/org.vinuxproject.sonic/lib/libvideokit.so
07-06 04:13:38.785: I/Videokit(28620): dlopen libvideokit from path: /data/data/org.vinuxproject.sonic/lib/libvideokit.so
07-06 04:13:38.785: I/ffmpeg4android(28620): =======ProgressBackgroundRemote doInBackground=========
07-06 04:13:38.785: W/linker(28620): libvideokit.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-06 04:13:38.795: I/Videokit(28620): libvideokit.so loaded
07-06 04:13:38.795: I/Videokit(28620): args is not NULL
07-06 04:13:38.795: I/Videokit(28620): more then one arg
07-06 04:13:38.795: I/Videokit(28620): function symbol found
07-06 04:13:38.795: D/Videokit(28620): Calling videokit run via loader
07-06 04:13:38.795: I/Videokit(28620): vk ffmpeg sdcardPath: /sdcard/emoj
07-06 04:13:38.795: I/Videokit(28620): licenseCheck in path: /sdcard/emoj
07-06 04:13:38.795: I/Videokit(28620): isLicExistsComplex...
07-06 04:13:38.795: I/Videokit(28620): trying to open /sdcard/emoj/ffmpeglicense.lic
07-06 04:13:38.795: I/Videokit(28620): license file found...
07-06 04:13:38.795: I/Videokit(28620): Permanent license validated.
07-06 04:13:38.795: D/Videokit(28620): license check rc: 1
07-06 04:13:38.795: D/Videokit(28620): run() called version 2.0
07-06 04:13:39.165: A/libc(28620): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x8 in tid 28620 (ct.sonic:remote)
07-06 04:13:39.655: D/ffmpeg4android(28481): onServiceDisconnected
07-06 04:13:40.805: I/ffmpeg4android(28656): =======service onCreate(): Stopping forground (to overcome 2.3.x bug)
07-06 04:13:40.805: I/ffmpeg4android(28656): =======service onBind()=======
07-06 04:13:40.815: I/ffmpeg4android(28656): ===onStartCommand called
07-06 04:13:40.815: D/ffmpeg4android(28656): Not running since the OS auto started the service after crash
07-06 04:13:40.815: D/ffmpeg4android(28481): Client onServiceConnected()
07-06 04:13:40.815: E/ffmpeg4android(28481): invokeService called
07-06 04:13:40.815: E/rc......(28481): 1
07-06 04:13:40.815: I/ffmpeg4android(28481): setting remote notification info
07-06 04:13:40.815: D/ffmpeg4android(28481): Not invoking
07-06 04:13:40.825: I/ffmpeg4android(28656): Cancel notification: 5326
07-06 04:13:41.135: I/ffmpeg4android(28481): Got real duration: 00:00:00.04
07-06 04:13:41.145: W/ffmpeg4android(28481): /sdcard/emoj/ffmpeg4android.log: open failed: ENOENT (No such file or directory)
07-06 04:13:41.145: I/ffmpeg4android(28481): ==== getting currentVkLogSize from FFmpeg4Android log
07-06 04:13:41.145: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:41.155: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:41.155: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:41.155: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:41.155: I/line(28481): exit_program: 1
07-06 04:13:41.155: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:41.155: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:41.155: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:41.455: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:41.455: D/ffmpeg4android(28481): currentVkLogSize: 5316
07-06 04:13:41.465: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:41.465: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:41.465: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:41.465: I/line(28481): exit_program: 1
07-06 04:13:41.465: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:41.465: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:41.465: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:41.765: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:41.765: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:41.765: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:41.765: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:41.765: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:41.765: I/line(28481): exit_program: 1
07-06 04:13:41.765: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:41.775: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:41.775: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:42.075: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:42.075: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:42.075: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:42.075: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:42.075: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:42.075: I/line(28481): exit_program: 1
07-06 04:13:42.075: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:42.075: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:42.075: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:42.375: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:42.375: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:42.375: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:42.385: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:42.385: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:42.385: I/line(28481): exit_program: 1
07-06 04:13:42.385: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:42.385: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:42.385: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:42.685: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:42.685: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:42.685: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:42.685: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:42.685: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:42.695: I/line(28481): exit_program: 1
07-06 04:13:42.695: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:42.695: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:42.695: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:42.995: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:42.995: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:42.995: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:42.995: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:42.995: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:42.995: I/line(28481): exit_program: 1
07-06 04:13:42.995: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:42.995: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:42.995: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:43.295: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:43.295: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:43.305: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:43.305: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:43.305: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:43.305: I/line(28481): exit_program: 1
07-06 04:13:43.305: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:43.305: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:43.305: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:43.605: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:43.605: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:43.615: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:43.615: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:43.615: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:43.615: I/line(28481): exit_program: 1
07-06 04:13:43.615: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:43.615: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:43.615: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:43.915: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:43.915: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:43.915: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:43.915: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:43.915: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:43.915: I/line(28481): exit_program: 1
07-06 04:13:43.915: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:43.925: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:43.925: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:44.225: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:44.225: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:44.225: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:44.225: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:44.225: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:44.225: I/line(28481): exit_program: 1
07-06 04:13:44.225: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:44.225: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:44.225: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:44.525: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:44.525: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:44.525: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:44.535: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:44.535: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:44.535: I/line(28481): exit_program: 1
07-06 04:13:44.535: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:44.535: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:44.535: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:44.835: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:44.835: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:44.835: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:44.835: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:44.835: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:44.835: I/line(28481): exit_program: 1
07-06 04:13:44.835: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:44.845: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:44.845: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:45.155: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:45.155: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:45.155: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:45.155: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:45.155: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:45.155: I/line(28481): exit_program: 1
07-06 04:13:45.155: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:45.155: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:45.155: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:45.455: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:45.455: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:45.455: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:45.455: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:45.455: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:45.455: I/line(28481): exit_program: 1
07-06 04:13:45.455: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:45.455: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:45.455: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:45.755: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:45.755: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:45.765: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:45.765: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:45.765: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:45.765: I/line(28481): exit_program: 1
07-06 04:13:45.765: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:45.765: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:45.765: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:46.065: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:46.065: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:46.065: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:46.075: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:46.075: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:46.075: I/line(28481): exit_program: 1
07-06 04:13:46.075: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:46.075: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:46.075: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:46.375: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:46.375: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:46.375: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:46.375: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:46.375: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:46.375: I/line(28481): exit_program: 1
07-06 04:13:46.385: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:46.385: I/ffmpeg4android(28481): progress is 0, not setting
07-06 04:13:46.385: I/ffmpeg4android(28481): progress is 0, not publishing
07-06 04:13:46.685: I/ffmpeg4android(28481): ==== getting currentVkLogSize from VK
07-06 04:13:46.685: W/ffmpeg4android(28481): Looks like Vk log is not increasing in size
07-06 04:13:46.685: I/ffmpeg4android(28481): No ffmpeg4android_log file, using vk log
07-06 04:13:46.685: I/line(28481): a suitable output format for '[ovrl],[0][ovrl]'
07-06 04:13:46.685: I/line(28481): [ovrl],[0][ovrl]: Invalid argument
07-06 04:13:46.685: I/line(28481): exit_program: 1
07-06 04:13:46.685: D/ffmpeg4android(28481): currentTimeStr: 00:00:00.00
07-06 04:13:46.685: E/ffmpeg4android(28481): VK log is not changing in size, and no exit token found
07-06 04:13:46.695: I/ffmpeg4android(28481): onProgressUpdate: 100
07-06 04:13:46.695: D/ffmpeg4android(28481): Releasing wake lock
07-06 04:13:46.695: D/ffmpeg4android(28481): TranscodeBackground onPostExecute
07-06 04:13:46.705: W/ffmpeg4android(28481): progressDialog failed to dismiss: null
07-06 04:13:46.705: W/ffmpeg4android(28481): android.os.DeadObjectException
07-06 04:13:46.705: W/ffmpeg4android(28481): at android.os.BinderProxy.transactNative(Native Method)
07-06 04:13:46.705: W/ffmpeg4android(28481): at android.os.BinderProxy.transact(Binder.java:496)
07-06 04:13:46.705: W/ffmpeg4android(28481): at com.netcompss.ffmpeg4android.IFfmpgefRemoteServiceBridge$Stub$Proxy.setTranscodingProgress(IFfmpgefRemoteServiceBridge.java:181)
07-06 04:13:46.705: W/ffmpeg4android(28481): at com.netcompss.ffmpeg4android_client.TranscodeBackground.onPostExecute(TranscodeBackground.java:163)
07-06 04:13:46.705: W/ffmpeg4android(28481): at com.netcompss.ffmpeg4android_client.TranscodeBackground.onPostExecute(TranscodeBackground.java:1)
07-06 04:13:46.705: W/ffmpeg4android(28481): at android.os.AsyncTask.finish(AsyncTask.java:632)
07-06 04:13:46.705: W/ffmpeg4android(28481): at android.os.AsyncTask.access$600(AsyncTask.java:177)
07-06 04:13:46.705: W/ffmpeg4android(28481): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
07-06 04:13:46.705: W/ffmpeg4android(28481): at android.os.Handler.dispatchMessage(Handler.java:102)
07-06 04:13:46.705: W/ffmpeg4android(28481): at android.os.Looper.loop(Looper.java:135)
07-06 04:13:46.705: W/ffmpeg4android(28481): at android.app.ActivityThread.main(ActivityThread.java:5232)
07-06 04:13:46.705: W/ffmpeg4android(28481): at java.lang.reflect.Method.invoke(Native Method)
07-06 04:13:46.705: W/ffmpeg4android(28481): at java.lang.reflect.Method.invoke(Method.java:372)
07-06 04:13:46.705: W/ffmpeg4android(28481): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
07-06 04:13:46.705: W/ffmpeg4android(28481): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
07-06 04:13:46.715: D/ffmpeg4android(28481): /sdcard/emoj/null length in bytes: 0
07-06 04:13:46.715: D/ffmpeg4android(28481): showNotifications
07-06 04:13:46.715: I/ffmpeg4android(28481): ============ Transcoding Failed, caling fexist
07-06 04:13:46.715: E/ffmpeg4android(28481): fexit remote excetion
07-06 04:13:46.765: I/ffmpeg4android(28481): FFMPEG finished.
07-06 04:13:46.985: D/ffmpeg4android(28481): releaseService()
07-06 04:13:46.985: D/ffmpeg4android(28481): Client stopService()
07-06 04:13:46.985: I/ffmpeg4android(28656): =======service onDestroy()======
07-06 04:13:46.985: W/ContextImpl(28481): Implicit intents with startService are not safe: Intent { act=com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge } android.content.ContextWrapper.stopService:520 com.netcompss.ffmpeg4android_client.BaseWizard.stopService:495 org.vinuxproject.sonic.WaveformActivity.handleServiceFinished:456 -
Android FFMPEG java concat multiple files
17 juillet 2015, par Kim TI’m using a fork of the cordova-plugin-video-editor library :
https://github.com/jbavari/cordova-plugin-video-editor/pull/13
Which uses the android-ffmpeg-java library here :
https://github.com/guardianproject/android-ffmpeg-java
The out of box cordova plugin example works well to encode a single video using the following code :
File tempFile = File.createTempFile("ffmpeg", null, appContext.getCacheDir());
FfmpegController ffmpegController = new FfmpegController(appContext, tempFile);
TranscodeCallback tcCallback = new TranscodeCallback();
Clip clipIn = new Clip(videoSrcPath);
Clip clipOut = new Clip(outputFilePath);
clipOut.videoCodec = "libx264";
clipOut.videoFps = "24"; // tailor this to your needs
clipOut.videoBitrate = 512; // 512 kbps - tailor this to your needs
clipOut.audioChannels = 1;
clipOut.width = outputWidth;
clipOut.height = outputHeight;
clipOut.duration = videoDuration;
ffmpegController.processVideo(clipIn, clipOut, true, tcCallback);This calls the android-ffmpeg-java code here :
They have a multiple file concat test example here :
So I have modified the cordova plugin code to match the example :
ArrayList<clip> listVideos = new ArrayList<clip>();
Clip clip = new Clip();
clip.path = new File(videoSrcPath).getCanonicalPath();
ffmpegController.getInfo(clip);
clip.duration = 5;
listVideos.add(clip);
Clip clip2 = new Clip();
clip2.path = new File(videoSrcPath2).getCanonicalPath();
ffmpegController.getInfo(clip2);
clip2.duration = 5;
listVideos.add(clip2);
Clip clipOut = new Clip();
clipOut.path = new File(outputFilePath).getCanonicalPath();
ffmpegController.concatAndTrimFilesMP4Stream(listVideos, clipOut, false, false, new ShellUtils.ShellCallback() {
@Override
public void shellOut(String shellLine) {
System.out.println("fc>" + shellLine);
}
@Override
public void processComplete(int exitValue) {
if (exitValue < 0)
System.err.println("concat non-zero exit: " + exitValue);
}
});
</clip></clip>However when run I get the error :
23:15:08.498 3218-3293/com.example.hello D/VideoEditor﹕ execute method starting
07-10 23:15:08.498 3218-3293/com.example.hello D/VideoEditor﹕ transcodeVideo firing
07-10 23:15:08.499 3218-3293/com.example.hello D/VideoEditor﹕ options: {"fileUri":"content:\/\/com.android.providers.media.documents\/document\/video%3A23389","fileUri2":"content:\/\/com.android.providers.media.documents\/document\/video%3A23390","outputFileName":"1436584506888","quality":2,"outputFileType":1,"optimizeForNetworkUse":1,"duration":2}
07-10 23:15:08.615 3218-3293/com.example.hello D/VideoEditor﹕ videoSrcPath: /storage/emulated/0/Movies/-a.mp4
07-10 23:15:08.615 3218-3293/com.example.hello D/VideoEditor﹕ videoSrcPath2: /storage/emulated/0/Movies/-b.mp4
07-10 23:15:08.618 3218-3293/com.example.hello V/VideoEditor﹕ outputFilePath: /storage/emulated/0/Movies/HelloWorld/VID_1436584506888.mp4
07-10 23:15:08.618 3218-3293/com.example.hello W/PluginManager﹕ THREAD WARNING: exec() call to VideoEditor.transcodeVideo blocked the main thread for 121ms. Plugin should use CordovaInterface.getThreadPool().
07-10 23:15:09.126 3742-3742/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.506 3750-3750/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.836 3218-3264/com.example.hello I/System.out﹕ fc>/data/data/com.example.hello/app_bin/ffmpeg -y -t 0 0 : 0 0 : 5.000000 -i /storage/emulated/0/Movies/-a.mp4 -f mpegts -c copy -an -bsf:v h264_mp4toannexb /storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/0.ts
07-10 23:15:09.864 3758-3758/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.865 3218-3759/com.example.hello I/System.out﹕ fc>WARNING: linker: /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.869 3218-3759/com.example.hello I/System.out﹕ fc>ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> built on Dec 22 2014 12:52:34 with gcc 4.6 20120106 (prerelease)
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libavutil 51. 54.100 / 51. 54.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libavcodec 54. 23.100 / 54. 23.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libavformat 54. 6.100 / 54. 6.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libavdevice 54. 0.100 / 54. 0.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libavfilter 2. 77.100 / 2. 77.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libswscale 2. 1.100 / 2. 1.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libswresample 0. 15.100 / 0. 15.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc> libpostproc 52. 0.100 / 52. 0.100
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc>[NULL @ 0xb6421100] Unable to find a suitable output format for '0'
07-10 23:15:09.870 3218-3759/com.example.hello I/System.out﹕ fc>0: Invalid argument
07-10 23:15:09.891 3218-3264/com.example.hello I/System.out﹕ fc>/data/data/com.example.hello/app_bin/ffmpeg -y -t 0 0 : 0 0 : 5.000000 -i /storage/emulated/0/Movies/-b.mp4 -f mpegts -c copy -an -bsf:v h264_mp4toannexb /storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/1.ts
07-10 23:15:09.912 3762-3762/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.913 3218-3763/com.example.hello I/System.out﹕ fc>WARNING: linker: /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.917 3218-3763/com.example.hello I/System.out﹕ fc>ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
07-10 23:15:09.917 3218-3763/com.example.hello I/System.out﹕ fc> built on Dec 22 2014 12:52:34 with gcc 4.6 20120106 (prerelease)
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libavutil 51. 54.100 / 51. 54.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libavcodec 54. 23.100 / 54. 23.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libavformat 54. 6.100 / 54. 6.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libavdevice 54. 0.100 / 54. 0.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libavfilter 2. 77.100 / 2. 77.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libswscale 2. 1.100 / 2. 1.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libswresample 0. 15.100 / 0. 15.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc> libpostproc 52. 0.100 / 52. 0.100
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc>[NULL @ 0xb6321100] Unable to find a suitable output format for '0'
07-10 23:15:09.918 3218-3763/com.example.hello I/System.out﹕ fc>0: Invalid argument
07-10 23:15:09.940 3218-3264/com.example.hello I/System.out﹕ fc>/data/data/com.example.hello/app_bin/ffmpeg -y -i concat:/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/0.ts|/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/1.ts -c copy -an /storage/emulated/0/Movies/HelloWorld/VID_1436584506888.mp4
07-10 23:15:09.963 3766-3766/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.964 3218-3767/com.example.hello I/System.out﹕ fc>WARNING: linker: /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
07-10 23:15:09.971 3218-3767/com.example.hello I/System.out﹕ fc>ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
07-10 23:15:09.972 3218-3767/com.example.hello I/System.out﹕ fc> built on Dec 22 2014 12:52:34 with gcc 4.6 20120106 (prerelease)
07-10 23:15:09.972 3218-3767/com.example.hello I/System.out﹕ fc> configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib
07-10 23:15:09.973 3218-3767/com.example.hello I/System.out﹕ fc> libavutil 51. 54.100 / 51. 54.100
07-10 23:15:09.973 3218-3767/com.example.hello I/System.out﹕ fc> libavcodec 54. 23.100 / 54. 23.100
07-10 23:15:09.974 3218-3767/com.example.hello I/System.out﹕ fc> libavformat 54. 6.100 / 54. 6.100
07-10 23:15:09.974 3218-3767/com.example.hello I/System.out﹕ fc> libavdevice 54. 0.100 / 54. 0.100
07-10 23:15:09.974 3218-3767/com.example.hello I/System.out﹕ fc> libavfilter 2. 77.100 / 2. 77.100
07-10 23:15:09.975 3218-3767/com.example.hello I/System.out﹕ fc> libswscale 2. 1.100 / 2. 1.100
07-10 23:15:09.976 3218-3767/com.example.hello I/System.out﹕ fc> libswresample 0. 15.100 / 0. 15.100
07-10 23:15:09.976 3218-3767/com.example.hello I/System.out﹕ fc> libpostproc 52. 0.100 / 52. 0.100
07-10 23:15:09.976 3218-3767/com.example.hello I/System.out﹕ fc>concat:/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/0.ts|/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/1.ts: Not a directory
07-10 23:15:09.981 3218-3264/com.example.hello D/VideoEditor﹕ transcode exception
java.lang.Exception: There was a problem rendering the video: /storage/emulated/0/Movies/HelloWorld/VID_1436584506888.mp4
at org.ffmpeg.android.FfmpegController.concatAndTrimFilesMP4Stream(FfmpegController.java:1272)
at org.apache.cordova.videoeditor.VideoEditor$1.run(VideoEditor.java:257)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)I’m not sure why it says ’Not a directory’ ? Surely it’s valid because the files are created at the previous step ?
-
video proccesing : extract frames and encrypt them then insert them back to the video in java using xuggler
24 juillet 2015, par Anas M. JubaraI’m working on a video encryption application .. the main idea is to input the video file to the application and the application should output it in an encrypted form... am using xuggler library to manipulate the video and get to the frames and AES for encryption.
my code works fine for accessing the frames and encrypting them, what i need help with is how to write the encrypted frame back to the video file to replace the original one without corrupting the video file for the video players.
Here is my codepackage xuggler;
import com.xuggle.mediatool.IMediaReader;
import com.xuggle.mediatool.IMediaWriter;
import com.xuggle.mediatool.MediaListenerAdapter;
import com.xuggle.mediatool.ToolFactory;
import com.xuggle.mediatool.event.IVideoPictureEvent;
import com.xuggle.xuggler.Global;
import com.xuggle.xuggler.ICodec;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Transparency;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.ComponentColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
import java.io.File;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.imageio.ImageIO;
public class DecodeAndCaptureFrames extends MediaListenerAdapter
{
// The number of seconds between frames.
public static final double SECONDS_BETWEEN_FRAMES = 5;
//The number of micro-seconds between frames.
public static final long MICRO_SECONDS_BETWEEN_FRAMES =(long) (Global.DEFAULT_PTS_PER_SECOND * SECONDS_BETWEEN_FRAMES);
// Time of last frame write
private static long mLastPtsWrite = Global.NO_PTS;
private static final double FRAME_RATE = 50;
private static final int SECONDS_TO_RUN_FOR = 20;
private static final String outputFilename = "D:\\K.mp4";
public static IMediaWriter writer = ToolFactory.makeWriter(outputFilename);
//receive BufferedImage and returns its byte data
public static byte[] get_byte_data(BufferedImage image) {
WritableRaster raster = image.getRaster();
DataBufferByte buffer = (DataBufferByte) raster.getDataBuffer();
return buffer.getData();
}
//create new_img with the attributes of image
public static BufferedImage user_space(BufferedImage image) {
//create new_img with the attributes of image
BufferedImage new_img = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
Graphics2D graphics = new_img.createGraphics();
graphics.drawRenderedImage(image, null);
graphics.dispose(); //release all allocated memory for this image
return new_img;
}
public static BufferedImage toImage(byte[] imagebytes, int width, int height) {
DataBuffer buffer = new DataBufferByte(imagebytes, imagebytes.length);
WritableRaster raster = Raster.createInterleavedRaster(buffer, width, height,
3 * width, 3, new int[]{2, 1, 0}, (Point) null);
ColorModel cm = new ComponentColorModel(ColorModel.getRGBdefault().getColorSpace(),
false, true, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
return new BufferedImage(cm, raster, true, null);
}
public static byte[] encrypt(byte[] orgnlbytes, String key) throws NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException {
byte[] encbytes = null;
try {
Cipher cipher = Cipher.getInstance("AES");
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
// cryptograph. secure random
random.setSeed(key.getBytes());
keyGen.init(128, random);
// for example
SecretKey secretKey = keyGen.generateKey();
try {
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
} catch (InvalidKeyException ex) {
Logger.getLogger(DecodeAndCaptureFrames.class.getName()).log(Level.SEVERE, null, ex);
}
encbytes = cipher.doFinal(orgnlbytes);
}
catch (NoSuchAlgorithmException ex) {
Logger.getLogger(DecodeAndCaptureFrames.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchPaddingException ex)
{
System.out.print("can not encrypt buffer");
}
return encbytes;
}
/**
* The video stream index, used to ensure we display frames from one
* and only one video stream from the media container.
*/
private int mVideoStreamIndex = -1;
/**
* Takes a media container (file) as the first argument, opens it and
* writes some of it's video frames to PNG image files in the
* temporary directory.
*
* @param args must contain one string which represents a filename
*/
public static void main(String[] args)
{
// create a new mr. decode and capture frames
DecodeAndCaptureFrames decodeAndCaptureFrames;
decodeAndCaptureFrames = new DecodeAndCaptureFrames("D:\\K.mp4");
}
/** Construct a DecodeAndCaptureFrames which reads and captures
* frames from a video file.
*
* @param filename the name of the media file to read
*/
//makes reader to the file and read the data of it
public DecodeAndCaptureFrames(String filename)
{
// create a media reader for processing video
IMediaReader reader = ToolFactory.makeReader(filename);
// stipulate that we want BufferedImages created in BGR 24bit color space
reader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);
// note that DecodeAndCaptureFrames is derived from
// MediaReader.ListenerAdapter and thus may be added as a listener
// to the MediaReader. DecodeAndCaptureFrames implements
// onVideoPicture().
reader.addListener(this);
// read out the contents of the media file, note that nothing else
// happens here. action happens in the onVideoPicture() method
// which is called when complete video pictures are extracted from
// the media source
while (reader.readPacket() == null)
do {} while(false);
}
/**
* Called after a video frame has been decoded from a media stream.
* Optionally a BufferedImage version of the frame may be passed
* if the calling {@link IMediaReader} instance was configured to
* create BufferedImages.
*
* This method blocks, so return quickly.
*/
public void onVideoPicture(IVideoPictureEvent event)
{
try
{
// if the stream index does not match the selected stream index,
// then have a closer look
if (event.getStreamIndex() != mVideoStreamIndex)
{
// if the selected video stream id is not yet set, go ahead an
// select this lucky video stream
if (-1 == mVideoStreamIndex)
mVideoStreamIndex = event.getStreamIndex();
// otherwise return, no need to show frames from this video stream
else
return;
}
// if uninitialized, backdate mLastPtsWrite so we get the very
// first frame
if (mLastPtsWrite == Global.NO_PTS)
mLastPtsWrite = event.getTimeStamp() - MICRO_SECONDS_BETWEEN_FRAMES;
// if it's time to write the next frame
if (event.getTimeStamp() - mLastPtsWrite >= MICRO_SECONDS_BETWEEN_FRAMES)
{
// Make a temporary file name
// File file = File.createTempFile("frame", ".jpeg");
// write out PNG
// ImageIO.write(event.getImage(), "png", file);
BufferedImage orgnlimage = event.getImage();
orgnlimage = user_space(orgnlimage);
byte[] orgnlimagebytes = get_byte_data(orgnlimage);
byte[] encryptedbytes = encrypt(orgnlimagebytes, "abc");
BufferedImage encryptedimage = toImage(encryptedbytes, orgnlimage.getWidth(), orgnlimage.getHeight());
ImageIO.write(encryptedimage, "png", File.createTempFile("frame", ".png"));
// indicate file written
double seconds = ((double)event.getTimeStamp())
/ Global.DEFAULT_PTS_PER_SECOND;
// System.out.printf("at elapsed time of %6.3f seconds wrote: %s\n",seconds, file);
// update last write time
mLastPtsWrite += MICRO_SECONDS_BETWEEN_FRAMES;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}