Sudhansu Joshi
Sudhansu Joshi

Reputation: 265

Trim the video to 5 minutes

I am working on a demo project on which I have to get only 5 minutes video is there any way to trim the video to 5 minutes only. Currently, I am using FFmpeg flutter to get the video file and its metadata.

Upvotes: 2

Views: 4981

Answers (3)

Santosh Anand
Santosh Anand

Reputation: 1228

You can use following command code to split a video.

final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();   

_flutterFFmpeg
  .execute(
    '-i videoplayback.mp4 -ss 00:00:50 -t 00:01:30 -c copy smallfile1.mp4')
  .then((value) {
    print('Got value ');
  }).catchError((error) {
    print('Error');
  });

Start time is -ss 00:00:50 end time is 00:01:30

Upvotes: 1

Santosh Anand
Santosh Anand

Reputation: 1228

For getting video information you may can try following code.

fFmpeg.execute('-i video.mp4 -f null /dev/null').then((value) {
  print('Got value ');
}).catchError((error) {
  print('Error');
});

Upvotes: 1

user969068
user969068

Reputation: 2943

You can use any ffmpeg command in execute() method of flutter-ffmpeg package, to trim first 5 minutes of video

import 'package:flutter_ffmpeg/flutter_ffmpeg.dart';
....

final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();
_flutterFFmpeg.execute("-ss 00:00:00 -i input.mp4 -to 00:05:00 -c copy output.mp4").then((rc) => print("FFmpeg process exited with rc $rc"));

Upvotes: 2

Related Questions