Closed cameronws closed 8 years ago
There is a way on Android currently using the execFFMPEG
command. There isn't a way on either platform yet using the transcodeVideo
function. I've thought about allowing additional options to transcodeVideo
such as -
Thanks.
Output dimensions would be very very excellent. To move video to square format like instagram etc
This is up on there on the list. I feel that first there needs to be a way to get the current width/height on a video so you can know what lower resolution you should use (without losing the aspect ratio and stretching it).
I'm wanting to make a VideoEditor
function that works the same on all platforms that returns the following video info -
This will allow for fine tuning on the transcodeVideo
function.
The below code :
var cmd = ['-i', inputFilePath, '-v', 'quiet', '-print_format', 'json', '-show_format', '-show_streams'];
VideoEditor.execFFPROBE(
ffmpegSuccess,
ffmpegError,
{
cmd: cmd,
progress: function(info) {
console.log(info);
}
}
);
function ffmpegSuccess(result) {
console.log('execFFMPEG success');
}
function ffmpegError(err) {
console.log('ffmpegError, err: ' + err);
}
echo
{
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "High",
"codec_type": "video",
"codec_time_base": "1/180000",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 1920,
"height": 1080,
"coded_width": 1920,
"coded_height": 1088,
"has_b_frames": 0,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "16:9",
"pix_fmt": "yuv420p",
"level": 40,
"chroma_location": "left",
"refs": 1,
"is_avc": "true",
"nal_length_size": "4",
"r_frame_rate": "30000/1001",
"avg_frame_rate": "900000/30019",
"time_base": "1/90000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 180114,
"duration": "2.001267",
"bit_rate": "16077085",
"bits_per_raw_sample": "8",
"nb_frames": "60",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0
},
"tags": {
"creation_time": "2016-02-08 03:14:19",
"language": "eng",
"handler_name": "VideoHandle"
}
},
{
"index": 1,
"codec_name": "aac",
"codec_long_name": "AAC (Advanced Audio Coding)",
"profile": "LC",
"codec_type": "audio",
"codec_time_base": "1/48000",
"codec_tag_string": "mp4a",
"codec_tag": "0x6134706d",
"sample_fmt": "fltp",
"sample_rate": "48000",
"channels": 2,
"channel_layout": "stereo",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/48000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 97930,
"duration": "2.040208",
"bit_rate": "156364",
"max_bit_rate": "96000",
"nb_frames": "95",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0
},
"tags": {
"creation_time": "2016-02-08 03:14:19",
"language": "eng",
"handler_name": "SoundHandle"
}
}
],
"format": {
"filename": "/storage/emulated/0/DCIM/100ANDRO/MOV_0591.mp4",
"nb_streams": 2,
"nb_programs": 0,
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
"format_long_name": "QuickTime / MOV",
"start_time": "0.000000",
"duration": "2.027000",
"size": "4095746",
"bit_rate": "16164759",
"probe_score": 100,
"tags": {
"major_brand": "mp42",
"minor_version": "0",
"compatible_brands": "isommp42",
"creation_time": "2016-02-08 03:14:19",
"location": "+48.8160+002.3633/",
"location-eng": "+48.8160+002.3633/"
}
}
}
@bertho-zero
I added execFFPROBE
to the docs. I've integrated PR #59 into master won't make it in the plugin on npm until 1.0.6
This is possible now in 1.0.6
https://github.com/jbavari/cordova-plugin-video-editor#transcode-a-video
Don't provide a width
and height
to transcodeVideo
if you want don't want the scale the video.
There is also a new maintainAspectRatio
option that is really helpful.
Is there a way to compress videos without changing the resolution/aspect ratio?