Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove videoToGif and instead add creating a short video without sound #24

Closed
vlada3003 opened this issue Jun 19, 2019 · 13 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@vlada3003
Copy link
Collaborator

Description

Since Gif is lossless format, gifs made from video have are bigger in size than short videos without audio. Also, there is a problem with Regift library since it is targeting iOS 11.1. My suggestion is to remove videoToGif and add a couple of optional parameters to startCompression for creating video preview.

Platform

Both

Code Example (if has)

void main() {
     _flutterVideoCompress.startCompress(
          file.path,
          deleteOrigin: true,
          quality: VideoQuality.LowQuality,
          startTime: 0,
          duration: 5,
          includeAudio: false,
          frameRate: 24,
        );
}

Expected solution

I will implement this by adding parameters to this method if @TenkaiRuri agrees?

@vlada3003 vlada3003 added the enhancement New feature or request label Jun 19, 2019
@vlada3003
Copy link
Collaborator Author

I would also add additional quality parameters if that is ok with you?

@rurico
Copy link
Owner

rurico commented Jun 19, 2019

Regift can be solved with the below settings

pre_install do |installer|
  installer.analysis_result.specifications.each do |s|
      if s.name == 'Regift'
        s.swift_version = '4.0'
    # elsif s.name == 'other-Plugin'
    #   s.swift_version = '5.0'
    # else
    #   s.swift_version = '4.0'
      end
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

remove videoToGif will make it complicates

I would also add additional quality parameters if that is ok with you?

I plan adding other qualities to IOS, It is convenient to solve on Android

@rurico
Copy link
Owner

rurico commented Jun 19, 2019

I plan to do the following things

class CustomModel {
  Sting title;
  Sting otherField;
}

class FlutterVideoCompress {
  _mediaInfo = {
      'title': MediaMetadataRetriever.METADATA_KEY_TITLE;
  }

  void setMediaInfoTemplate(Map<String, MediaMetadataRetriever> custom) {
    _mediaInfo = custom;
  }

  Future<T = MediaInfo> getMediaInfo(String path) async {
    invoke(.., _mediaInfo)
  }
}

await getMediaInfo<CustomModel>(path)

@vlada3003
Copy link
Collaborator Author

Cool. I'll try the Regift fix. However, I don't understand what you plan to do with CustomModel? You want to switch from json to your data classes?

@rurico
Copy link
Owner

rurico commented Jun 19, 2019

User can customize MediaInfo return and expectation data structures.
look at the MediaMetadataRetriever class and you will understand me

@vlada3003
Copy link
Collaborator Author

I understand, is there any performance reason why you are doing this, or you just want more structured response?

@rurico
Copy link
Owner

rurico commented Jun 19, 2019

Just want more structured response

@GustavoContreiras
Copy link
Contributor

GustavoContreiras commented Jun 19, 2019

An option to set new aspect ratio would be nice too!

Edit:
Actually having a gif option, even with the heavy size issue, is good.
If you have a video, you will need a video player. If you have many video players and try to record a video with image picker, camera will crash. I'm facing that issue. So I'm using a gif with CachedNetworkImageProvider instead of a video with a VideoPlayer.

@rurico
Copy link
Owner

rurico commented Jun 20, 2019

@vlada3003 I suggest this should be better.

Future<MediaInfo> startCompress(
    String path, {
    VideoQuality quality = VideoQuality.DefaultQuality,
    bool deleteOrigin = false,
    bool includeAudio = false,
    int frameRate = 24,
  }) async {
}

Future<MediaInfo> cropAndCompress(
    String path, {
    VideoQuality quality = VideoQuality.DefaultQuality,
    bool deleteOrigin = false,
    bool includeAudio = false,
    int frameRate = 24,
    int startTime = 0,
    int endTime = -1,
    int duration = -1,
  }) async {
}

@vlada3003
Copy link
Collaborator Author

@TenkaiRuri for the cropAndCompress method, what is meant by crop part?

@rurico
Copy link
Owner

rurico commented Jun 20, 2019

@vlada3003 Crop video

@vlada3003
Copy link
Collaborator Author

I understand that, but crop to what?

@rurico
Copy link
Owner

rurico commented Jun 20, 2019

Due to my English I am very sorry, I may think too much. This enhancement is great

Future<MediaInfo> startCompress(
  String path, {
  VideoQuality quality = VideoQuality.DefaultQuality,
  bool deleteOrigin = false,
  bool includeAudio = false,
  int frameRate = 24,
  int startTime = 0,
  int endTime = -1,
  int duration = -1,
}) async {}

@rurico rurico added the testing testing label Jun 24, 2019
@rurico rurico closed this as completed Jun 26, 2019
@rurico rurico removed testing testing labels Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants