triniwiz / nativescript-videorecorder

:video_camera: NativeScript plugin for Video Recording . :video_camera:
Apache License 2.0
43 stars 29 forks source link

Quality Settings #55

Closed mrwrighty closed 4 years ago

mrwrighty commented 5 years ago

Trying to control the video quality on iOS. The Plugin is working great and I can upload files to my webservice, however there is a massive difference in quality and size between hd: false and hd: true. The hd: false setting gives the MMS quality video which is poor but small is file size and hd: true gives excellent quality as you would expect, but a massive file size. 20 seconds being around 32MB which takes about 30 seconds to upload on 4G. Is there a way to set an intermediate quality, I've tried 720P etc but it makes not difference. My settings are done here:-

var vr = new nativescript_videorecorder_1.VideoRecorder({hd: false, position: nativescript_videorecorder_1.CameraPosition.NONE, size: 50, duration: 40, quality: 'MAX_720P' });

I used to use the Cordova video plugin in another development environment which created a video at 360 x 480 which was ideal. The MMS size is just a bit small and quality is poor.

triniwiz commented 5 years ago

You can use the advanced camera class where you can control most of that 🙂

mrwrighty commented 5 years ago

Can you advise as I thought I had tried that with no luck, can you give an example please.

triniwiz commented 5 years ago

here and here

mrwrighty commented 5 years ago

OK I have now implemented the Advanced Camera class which works great, however the minimum size I can set is 480P which is still an 8mb file for 22 seconds. I was hoping to get 360x480P so 360P as the quality setting, but this seems to be ignored. 480P OK, 720P OK, 1080P OK, but nothing lower.

triniwiz commented 5 years ago

I'll add in 360p but there is QVGA you can use for now

mrwrighty commented 5 years ago

That would be great, thanks.

mrwrighty commented 5 years ago

Tried QVGA, did seem to make any difference.

triniwiz commented 5 years ago

Try non caps

mrwrighty commented 5 years ago

perfect thanks.

mrwrighty commented 5 years ago

Do you alter the mp4 compression for the files or is that device dependant.

mrwrighty commented 5 years ago

Also for the record the output from the basic control is different from the advanced control.

Basic is "/private/var/mobile/Containers/Data/Application/589D652E-BD66-4AB0-995F-138FA124CB67/tmp/57072391264__E5EE7577-52BE-4DC9-BF6A-3DB558B5F85B.MOV"

Advanced is "file:///var/mobile/Containers/Data/Application/DD38E1A8-F725-4A87-89DB-4DF0C9BEA35D/Library/Caches/VID_1549031388466.mp4"

I had to strip off the file:// from the beginning of the string top use nativescript-background-http formdata upload.

triniwiz commented 5 years ago

I don't alter the any extra settings and i'll look unifying it also the plugin will be deprecated sooner or later in favor of this

mrwrighty commented 5 years ago

OK, look interesting, I look forwards to trying it out.

mrwrighty commented 5 years ago

Could you implement a maximum video length setting in the Advance option in this version and the new version please.

mrwrighty commented 5 years ago

Is it possible to control the file output type i.e H264 rather than HEVC in iOS. HEVC as limited support in Internet Explorer/Windows 10. Using qvga results in an MP4 file, but is still HEVC, using any other format such as 1080P results in an MOV file in H264 format.

Tronix117 commented 5 years ago

You can handle the max video length yourself on AdvacnedVideo, by stoping the recording yourself after a certain amount of time.

For the transcoding, this module does not support transcoding. I made a transcoding poc there : https://github.com/Wikodit/nativescript-transcoder , it support only Android Hard Transcoding for now, iOS is easy to implement but I don't have the budget and time to finish the development of it.

triniwiz commented 5 years ago

@Tronix117 there are also two other transcoders ffmpeg and video-editor

Ghits-nl commented 4 years ago

Is this repo also avaiable in Javascript?

Ghits-nl commented 4 years ago

does any body knows how to write this two rows code with javascript import * as pages from 'tns-core-modules/ui/page'; export function loaded(args: pages.NavigatedData) { page = args.object; }

Tronix117 commented 4 years ago

@Ghits-nl could you open a new thread when it is not the subject ? Otherwise, you can simply replace above code by:

module.exports = {
  loaded(args) {
    page = args.object;
    ...
  }
}

pages is only used here in TypeScript to define the type of args.object.

Ghits-nl commented 4 years ago

module.exports = { loaded(args) { page = args.object; ... } }

Thank you

Ghits-nl commented 4 years ago

I am trying to get the AdvancedVideoView runing but the function recorder.startRecording(); on advanced page mentionerd in demo does not response. Any idea? Normal video recorder works fine but recorded video's are too big. I want to record in qvga quality. I am using andriod

Ghits-nl commented 4 years ago

export function recordVideo() { recorder.startRecording(); } ; on advanced page does not start the camera. Any idea is much appretiated!

Ghits-nl commented 4 years ago

@Ghits-nl could you open a new thread when it is not the subject ? Otherwise, you can simply replace above code by:

module.exports = {
  loaded(args) {
    page = args.object;
    ...
  }
}

pages is only used here in TypeScript to define the type of args.object.

could you please convert this also to JS: import { AdvancedVideoViewBase } from './advanced-video-view.common';

export declare class AdvancedVideoView extends AdvancedVideoViewBase { readonly duration: number; readonly thumbnails: string[];

public startRecording(): void;

public stopRecording(): void;

public stopPreview(): void;

public toggleCamera(): void;

public startPreview(): void;

public static requestPermissions(explanation?: string): Promise<any>;

public static isAvailable(): boolean;

}

Ghits-nl commented 4 years ago

OK I have now implemented the Advanced Camera class which works great, however the minimum size I can set is 480P which is still an 8mb file for 22 seconds. I was hoping to get 360x480P so 360P as the quality setting, but this seems to be ignored. 480P OK, 720P OK, 1080P OK, but nothing lower.

I am trying to do that but it does not work for me. I do not get any error but the camera does not start to record. it seems that recorder.startRecording(); not respondig. any idea?

Ghits-nl commented 4 years ago

Except the "Video recorder" button on advanced page in the other buttons not working. Any suggestions is appreciated.

Ghits-nl commented 4 years ago

advanced camera class

is advanced camera class working for andriod too?