Isvisoft / flutter_screen_recording

A new Flutter plugin for record the screen.
MIT License
146 stars 142 forks source link

File format isn't supported! #17

Closed msugamsingh closed 4 years ago

msugamsingh commented 4 years ago

Getting File format isn't supported or files are corrupted. when opening in any media player.

vvalladolidIV commented 4 years ago

Hi, ¿could you give us information about your test device? ¿Maybe your console information? The output format is .mp4 so is strange media player don't recognise it.

msugamsingh commented 4 years ago

I tried running your example code in a physical Xiaomi (Android 8) device and in emulator (Android 9), but it didn't work. There's no warning or error in console. Also, The size of the .mp4 output file in storage is always less than 10kb. App permissions: Storage and microphone

salime45 commented 4 years ago

I checked in different devices and works normally. Can you check the permission section and see if all permissions are enabled?

Are you sure not log appear in the console? We put in all critical places for get more info

msugamsingh commented 4 years ago

I apologize that I did not notice before. I'm getting some errors in console.

D/permissions_handler(20570): No android specific permissions needed for: 9 I/System.out(20570): Scaled Density I/System.out(20570): 2.0 I/System.out(20570): Original Resolution I/System.out(20570): 720 x 1344 I/System.out(20570): Calcule Resolution I/System.out(20570): 685 x 1280 F/SoftVideoEncoderOMXComponent(21104): frameworks/av/media/libstagefright/omx/SoftVideoEncoderOMXComponent.cpp:465 CHECK((width & 1) == 0) failed. E/MediaRecorder(20570): stop failed: -1007 D/--INIT-RECORDER(20570): stop failed. I/System.out(20570): stopRecordScreen error I/System.out(20570): stop failed. D/TAG (20570): MediaProjection Stopped I/flutter (20570): Opening video I/flutter (20570): /storage/emulated/0/DCIM/hello.mp4

Again, I apologize for my mistake.

salime45 commented 4 years ago

In my experience when you try to record the screen with a low reoslution like 685 the MediaRecorder doesnt work.

Can you try to modify maxRes in calculeResolution with a higher value?

The function to edit is in flutter_screen_recording/android/src/main/kotlin/com/isvisoft/flutter_screen_recording/FlutterScreenRecordingPlugin.kt

msugamsingh commented 4 years ago

I modified maxRes to 680 and its working now.

However, The quality is low but it will work for me.

Thanks 🙂

salime45 commented 4 years ago

The Android library for record screen have some problems with the resolution. Thanks for your feedback