EDEDIN-Solutions / video_watermark

https://pub.dev/packages/video_watermark
BSD 3-Clause "New" or "Revised" License
2 stars 7 forks source link

Video Quality #8

Open hamzasidd3634 opened 1 year ago

hamzasidd3634 commented 1 year ago

Video quality is compromising after adding watermark please fix this issue

dzab5 commented 1 year ago

this issue should have top priority, basically undercuts the whole point of the package

SuganDevp commented 1 year ago

Our team is working on it and will get the best update. Stay tuned....💪

Jeff-Ayako commented 8 months ago

Since March No breakthrough yet on the video Quality issue?

emreaktrk commented 6 months ago

I found a solution.

Created my own watermark class that extends watermark, and i modified the toCommand fuction by adding bitrate command. You can add your own commands. FFMEG documentation

class QualityWatermark extends Watermark {
  final String bitrate;

  QualityWatermark({
    required super.image,
    required super.watermarkAlignment,
    required super.watermarkSize,
    required this.bitrate,
  });

  @override
  Future<String> toCommand() async {
    final command = await super.toCommand();
    return "$command -b:v $bitrate";
  }
}

and use it at VideoWatermark class.

    VideoWatermark(
      sourceVideoPath: videoFile.path,
      watermark: QualityWatermark(
        image: WatermarkSource.file(watermarkFile.path),
        watermarkAlignment: WatermarkAlignment.topLeft,
        watermarkSize: WatermarkSize(
          size?.width ?? -1,
          size?.height ?? -1,
        ),
        bitrate: '1M',
      ),
      outputFormat: OutputFormat.mp4,
      onSave: (path) => completer.complete(path),
    );

I am lazy to create enum values for bitrate field. 😄

By this method, you can inject additional commands.

programmermager commented 5 months ago

I found a solution.

Created my own watermark class that extends watermark, and i modified the toCommand fuction by adding bitrate command. You can add your own commands. FFMEG documentation

class QualityWatermark extends Watermark {
  final String bitrate;

  QualityWatermark({
    required super.image,
    required super.watermarkAlignment,
    required super.watermarkSize,
    required this.bitrate,
  });

  @override
  Future<String> toCommand() async {
    final command = await super.toCommand();
    return "$command -b:v $bitrate";
  }
}

and use it at VideoWatermark class.

    VideoWatermark(
      sourceVideoPath: videoFile.path,
      watermark: QualityWatermark(
        image: WatermarkSource.file(watermarkFile.path),
        watermarkAlignment: WatermarkAlignment.topLeft,
        watermarkSize: WatermarkSize(
          size?.width ?? -1,
          size?.height ?? -1,
        ),
        bitrate: '1M',
      ),
      outputFormat: OutputFormat.mp4,
      onSave: (path) => completer.complete(path),
    );

I am lazy to create enum values for bitrate field. 😄

By this method, you can inject additional commands.

its work for me too. you should create PR for this issue dude @emreaktrk . thanks anyway.

btw its 1 year+ since @SuganDevp reply working on this issue 🤣