publicvoid convert2() throws IOException{
dila =ProgressDialog.show(uploadved.this,"برجاء الانتظار","جاري تجهيز الفيديو");File videoFile =newFile(videoUri.toString());if(videoFile.exists()){MediaMetadataRetriever retriever =newMediaMetadataRetriever();
retriever.setDataSource(videoFile.getPath());String height = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT);Log.e("tyyyyy","h"+ height);String width = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH);Log.e("tyyyyy","w"+ width);
w =Integer.parseInt(width);
h =Integer.parseInt(height);int quality = w * h /1024*1024/1000;
qul =String.valueOf(quality);Log.e("tyyyyy", qul);
retriever.release();if(h >1024){try{File file =newFile(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), displayName +".mp4");
file.createNewFile();String outputPath = file.getPath().toString();Log.d("tyyyyy","outpath is "+ outputPath);
retriever.setDataSource(videoFile.getPath());Bitmap bmp = retriever.getFrameAtTime();int newWidth =576;int newHeight =1024;Bitmap resizedBmp =Bitmap.createScaledBitmap(bmp, newWidth, newHeight,true);
retriever.release();// Save the video to the phoneMediaMuxer muxer =newMediaMuxer(outputPath,MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);// Add the video trackint videoTrackIndex = muxer.addTrack(MediaFormat.createVideoFormat(outputPath, newWidth, newHeight));String aduo =String.valueOf(videoTrackIndex);Log.e("tyyyyy","videoResolution"+"="+ aduo);// Add the audio trackint audioTrackIndex = muxer.addTrack(MediaFormat.createAudioFormat(outputPath,44100,2));String adad =String.valueOf(audioTrackIndex);Log.e("tyyyyy","videoResolution"+"="+ adad);// Start writing to the muxer
muxer.start();// Write the video frames to the muxerByteBuffer buffer =ByteBuffer.allocateDirect(1024*1024);int[] pixels =newint[resizedBmp.getWidth()* resizedBmp.getHeight()];for(int i =0; i < resizedBmp.getHeight(); i++){
buffer.clear();
resizedBmp.getPixels(pixels,0, resizedBmp.getWidth(),0, i, resizedBmp.getWidth(), resizedBmp.getHeight());
byte[] bytes =new byte[buffer.limit()];for(int j =0; j < bytes.length; j++){
bytes[j]= buffer.get(j);}MediaCodec.BufferInfo info =newMediaCodec.BufferInfo();
info.offset =0;
info.size = bytes.length;
muxer.writeSampleData(videoTrackIndex, buffer, info);}// Write the audio samples to the muxershort[] samples =newshort[resizedBmp.getWidth()* resizedBmp.getHeight()];int[] intSamples =newint[samples.length];for(int i =0; i < resizedBmp.getHeight(); i++){
buffer.clear();
resizedBmp.getPixels(intSamples,0, resizedBmp.getWidth(),0, i, resizedBmp.getWidth(), resizedBmp.getHeight());for(int j =0; j < samples.length; j++){
buffer.putShort((short) intSamples[j]);}
byte[] bytes = buffer.array();MediaCodec.BufferInfo info =newMediaCodec.BufferInfo();
info.offset =0;
info.size = bytes.length;
muxer.writeSampleData(audioTrackIndex, buffer, info);}// Stop writing to the muxer
muxer.stop();
muxer.release();
uritoupload =Uri.parse(outputPath);
vedgetr.setMediaController(newMediaController(this));
dila.dismiss();
vedgetr.setVideoURI(uritoupload);
vedgetr.start();}catch(IOException e){Log.e("tyyyyy","catch"+ e.getMessage().toString());}}elseif(w >576){try{Bitmap bmp = retriever.getFrameAtTime();int newWidth =576;int newHeight =1024;Bitmap resizedBmp =Bitmap.createScaledBitmap(bmp, newWidth, newHeight,true);
retriever.release();File newVideoFile =newFile(Environment.getExternalStorageDirectory(),"new_video.mp4");// Save the video to the phoneMediaMuxer muxer =newMediaMuxer(newVideoFile.getPath(),MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);// Add the video trackint videoTrackIndex = muxer.addTrack(MediaFormat.createVideoFormat(newVideoFile.getPath(), newWidth, newHeight));String aduo =String.valueOf(videoTrackIndex);Log.e("tyyyyy","videoResolution"+"="+ aduo);// Add the audio trackint audioTrackIndex = muxer.addTrack(MediaFormat.createAudioFormat(newVideoFile.getPath(),44100,2));String adad =String.valueOf(videoTrackIndex);Log.e("tyyyyy","videoResolution"+"="+ adad);// Start writing to the muxer
muxer.start();// Write the video frames to the muxerByteBuffer buffer =ByteBuffer.allocateDirect(1024*1024);int[] pixels =newint[resizedBmp.getWidth()* resizedBmp.getHeight()];for(int i =0; i < resizedBmp.getHeight(); i++){
buffer.clear();
resizedBmp.getPixels(pixels,0, resizedBmp.getWidth(),0, i, resizedBmp.getWidth(), resizedBmp.getHeight());
byte[] bytes =new byte[buffer.limit()];for(int j =0; j < bytes.length; j++){
bytes[j]= buffer.get(j);}MediaCodec.BufferInfo info =newMediaCodec.BufferInfo();
info.offset =0;
info.size = bytes.length;
muxer.writeSampleData(videoTrackIndex, buffer, info);}// Write the audio samples to the muxershort[] samples =newshort[resizedBmp.getWidth()* resizedBmp.getHeight()];int[] intSamples =newint[samples.length];for(int i =0; i < resizedBmp.getHeight(); i++){
buffer.clear();
resizedBmp.getPixels(intSamples,0, resizedBmp.getWidth(),0, i, resizedBmp.getWidth(), resizedBmp.getHeight());for(int j =0; j < samples.length; j++){
buffer.putShort((short) intSamples[j]);}
byte[] bytes = buffer.array();MediaCodec.BufferInfo info =newMediaCodec.BufferInfo();
info.offset =0;
info.size = bytes.length;
muxer.writeSampleData(audioTrackIndex, buffer, info);}// Stop writing to the muxer
muxer.stop();
muxer.release();
uritoupload =Uri.parse(newVideoFile.getPath());
vedgetr.setMediaController(newMediaController(this));
dila.dismiss();
vedgetr.setVideoURI(uritoupload);
vedgetr.start();}catch(IOException e){Log.e("tyyyyy","catch"+ e.toString());}}else{
vedgetr.setMediaController(newMediaController(this));
dila.dismiss();
vedgetr.start();}}else{// The video file does not existthrownewIllegalArgumentException("The video file does not exist");}}
ودى رسالة الخطأ
enableLogLight: enable =falseWindowClient com.tocrest.a2crest Add to mViews:DecorView@9438c40[برجاءالانتظار],this= android.view.WindowManagerGlobal@ac9d1fOpenGLRenderer com.tocrest.a2crest CanvasContext()0x7966362080ViewRootIm...الانتظار] com.tocrest.a2crest hardware acceleration is enabled,this=ViewRoot{3c1caffبرجاءالانتظار,ident =7}AndroidRuntime com.tocrest.a2crest Shutting down VM
--------- beginning of crash
art com.tocrest.a2crest Attempt to remove non-JNI local reference, dumping thread
AndroidRuntime com.tocrest.a2crest FATAL EXCEPTION: main
Process: com.tocrest.a2crest, PID:2997
java.lang.RuntimeException:Failure delivering result ResultInfo{who=null, request=100, result=-1, data=Intent{ dat=content://com.android.providers.media.documents/document/video:27122 flg=0x1 }} to activity {com.tocrest.a2crest/com.tocrest.a2crest.vedio.uploadved}: java.lang.IllegalArgumentException: The video file does not exist
at android.app.ActivityThread.deliverResults(ActivityThread.java:4547)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4590)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1772)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:232)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(NativeMethod)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1103)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)Caused by: java.lang.IllegalArgumentException:The video file does not exist
at com.tocrest.a2crest.vedio.uploadved.convert2(uploadved.java:542)
at com.tocrest.a2crest.vedio.uploadved.onActivityResult(uploadved.java:356)
at android.app.Activity.dispatchActivityResult(Activity.java:7234)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4543)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4590)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1772)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:232)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(NativeMethod)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1103)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)ActivityManager pid-1396Force finishing activity com.tocrest.a2crest/.vedio.uploadved
WindowManager pid-1396Set focused app to:AppWindowToken{6bf3439 token=Token{6089400ActivityRecord{1b60a83 u0 com.tocrest.a2crest/.vedio.watchervedio t545}}} old focus=AppWindowToken{388b03a token=Token{1146b65ActivityRecord{a18bc5c u0 com.tocrest.a2crest/.vedio.uploadved t545}}} moveFocusNow=trueProcess com.tocrest.a2crest Sending signal. PID:2997 SIG:9DropBoxManagerService pid-1396 file ::/data/system/dropbox/2023@08@02@M6763D_11.A.35_0350_202009032342@com.tocrest.a2crest@data_app_crash@868835034720615_1690951022453_1690951022543.txt.gz
--------- beginning of events
AES pid-1396 onEndOfErrorDumpThread: data_app_crash Process: com.tocrest.a2crest
Time:1690951022453Flags:0x28e8be46Package: com.tocrest.a2crest v15 (1.15)
PID:2997Foreground:YesBuild: OPPO/CPH1729/CPH1729:7.1.1/N6F26Q/1572535473:user/release-keys
java.lang.RuntimeException:Failure delivering result ResultInfo{who=null, request=100, result=-1, data=Intent{ dat=content://com.android.providers.media.documents/document/video:27122 flg=0x1 }} to activity {com.tocrest.a2crest/com.tocrest.a2crest.vedio.uploadved}: java.lang.IllegalArgumentException: The video file does not exist
at android.app.ActivityThread.deliverResults(ActivityThread.java:4547)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4590)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1772)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:232)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(NativeMethod)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1103)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)Caused by: java.lang.IllegalArgumentException:The video file does not exist
at com.tocrest.a2crest.vedio.uploadved.convert2(uploadved.java:542)
at com.tocrest.a2crest.vedio.uploadved.onActivityResult(uploadved.java:356)
at android.app.Activity.dispatchActivityResult(Activity.java:7234)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4543)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4590)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1772)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:232)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(NativeMethod)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1103)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
CPU usage from 315848ms to 0ms ago (٢٠٢٣-٠٨-٠٢٠٦:٣١:٤٦.٦٠٧ to ٢٠٢٣-٠٨-٠٢٠٦:٣٧:٠٢.٤٥٥):5.8%1396/system_server:4.2% user +1.5% kernel / faults:57043 minor 3629 major
5.7%406/surfaceflinger:3% user +2.7% kernel / faults:3428 minor 115 major
2%589/media.codec:0.8% user +1.2% kernel / faults:36572 minor 39 major
2%618/mediaserver:1.2% user +0.7% kernel / faults:1970 minor 45 major
1.7%5026/com.google.android.gms:1.4% user +0.3% kernel / faults:60968 minor 1621 major
1.2%15409/adbd:0.3% user +0.9% kernel / faults:11697 minor 4 major
1.2%233/exe_cq:0% user +1.2% kernel
0.7%98/kswapd0:0% user +0.7% kernel
0.6%30349/com.coloros.safesdkproxy:0.6% user +0% kernel / faults:11446 minor 931 major
1%3935/psensord:0% user +1% kernel / faults:13 minor
0.9%11274/tx_thread:0% user +0.9% kernel
0.9%317/logd:0.3% user +0.6% kernel / faults:1814 minor 58 major
0.8%235/mmcqd/0:0% user +0.8% kernel
0.6%12767/com.android.systemui:0.4% user +0.1% kernel / faults:7590 minor 473 major
0.5%608/audioserver:0.3% user +0.2% kernel / faults:731 minor 33 major
0.5%7/rcu_preempt:0% user +0.5% kernel
0.5%7377/com.google.android.gms.persistent:0.3% user +0.1% kernel / faults:24368 minor 1306 major
0.4%26267/kworker/u16:4:0% user +0.4% kernel
0.4%12492/com.nearme.statistics.rom:0.3% user +0.1% kernel / faults:9236 minor 604 major
0.3%226/ipi_cpu_dvfs_rt:0% user +0.3% kernel
0.3%24293/kworker/u16:3:0% user +0.3% kernel
0.3%10387/com.emoji.keyboard.touchpal:0.3% user +0% kernel / faults:15095 minor 625 major
0.3%28047/kworker/u16:1:0% user +0.3% kernel
0.3%32209/kworker/u16:5:0% user +0.3% kernel
0.3%405/servicemanager:0.1% user +0.2% kernel / faults:103 minor 2 major
0.3%587/aal:0.1% user +0.2% kernel / faults:73 minor
0.3%31570/kworker/u16:6:0% user +0.3% kernel
0.1%12387/com.coloros.safecenter:clear_filter:0.1% user +0% kernel / faults:3584 mino
08-0206:36:54.16713961396 I free_storage_changed:1398703718408-0206:36:54.59713961515 I netstats_mobile_sample:[903686017,862909,186362558,560307,893944289,675631,186393645,560541,740582713,632604,338812605,603029,-1]08-0206:36:54.59913961515 I netstats_wifi_sample:[6150509506,5131411,704049571,2674338,6078435988,5119481,666533956,2662971,6078124245,5117191,666521861,2662904,-1
AES pid-1396 process : com.tocrest.a2crest
AES pid-1396 module : com.tocrest.a2crest v15 (1.15)
AEE_LIBAEE pid-1396 shell: raise_exp(4,2997,-1361051648, com.tocrest.a2crest,0x0x79f8ffad60,0x0x0)
AEE_AED pid-4004Process:com.tocrest.a2crest
السؤال
Drive Man
ودى رسالة الخطأ
0 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.