erpnext icon indicating copy to clipboard operation
erpnext copied to clipboard

On Work Order Screen, In Items Child Table UOM is not showing.

Open nitin-anantpranali opened this issue 1 year ago • 6 comments

Information about bug

On Work Order Screen, In Items Child Table UOM is not showing.

Module

manufacturing

Version

Installed Apps ERPNext: v15.30.0 (HEAD) Frappe Framework: v15.36.0 (HEAD) Frappe HR: v15.24.0 (HEAD) India Compliance: v15.11.0 (HEAD) Payments: v0.0.1 (HEAD)

Installation method

FrappeCloud

Relevant log output / Stack trace / Full Error Message.

No response

nitin-anantpranali avatar Sep 04 '24 10:09 nitin-anantpranali

iOS compress the video by default and Android doesn't. That caused the difference. I do think it is variable to have an option to get a compressed video or original video. Any PR is welcomed!

cyanglaz avatar Apr 25 '19 22:04 cyanglaz

I would really like to get the original file in iOS, not a compressed version.

febg11 avatar Apr 11 '20 16:04 febg11

Still a valid proposal since is was not implemented in image_picker: ^0.6.7+22.

pedromassangocode avatar Feb 12 '21 13:02 pedromassangocode

It not only compresses the size but also change its codec (HVEC -> h264). Hope it can provide the original video file soon!

hyobbb avatar Mar 08 '21 14:03 hyobbb

I find a very good package that can pick original video https://pub.dev/packages/images_picker

amberfan avatar Aug 05 '21 07:08 amberfan

any update on this ?? @pedromassangocode

pr-1 avatar Oct 03 '21 05:10 pr-1

I'm using video_compress to do this. As far as I can see, iOS only compresses videos picked from the cameral roll, so I am compressing:

  • iOS videos recorded in-app,
  • Android videos recorded in-app,
  • Android videos picked from the gallery.

EDIT: yeah my bad, iOS compresses both new recordings and selections from the camera roll. Downvote deserved. If anyone knows how to disable iOS automatic compression I'd love to know.

spatialbits avatar Oct 04 '21 15:10 spatialbits

I opened a duplicate issue yesterday. I Added content from my duplicate issue below. It is so discouraging to open an issue only to find the same issue was already opened 4 years again and has been ignored ever since. Remind me again why we use Flutter?

The Image Picker's video compression should be optional or disabled completely. In my usecase, my app is opening a video to to perform some editing for the user, then saves the edited video back to the user's gallery. Below are the reasons compression causes a problem.

  1. It is not possible to retain the original/full quality of the original input video in the edited output video. This is because the plugin has already compressed the video before it is even edited. In most cases, the users would like to retain the original quality of the video.
  2. The compression process appears to be stripping & changing the meta data of the video. This is a problem because my app uses ffprobe to make use of the video's metadata as part of the editing process. The video returned to the app is basically a totally different video than what was selected (different resolution, metadata, etc.).
  3. The compression injects and additional and substantial delay in the file open process (especially for larger files) while the users waits for the video to compress. Meanwhile the users has not even asked for their video to be compressed.
  4. It is different from android. The same package on android does not compress videos. Platform differences like this greatly reduce the value of Flutter as developers must still handle different behavior for different platforms.

rlueders avatar Sep 16 '22 15:09 rlueders

To add to the list of issues with compress above, I have an unedited MP4 file from a Gopro that gets returned as JPG after getting compressed. I have other similar videos from he same gopro on which this does not happen.

rlueders avatar Sep 18 '22 11:09 rlueders

From what I can see, the video compression happening with ios can be disabled by adding the line imagePickerController.videoExportPreset = AVAssetExportPresetPassthrough; in the file FLTImagePickerPlugin.m at line 236 in the image_picker_ios package.

I tested with a .mov video, of original size 8.9Mb and dimension 2727x2304. With the standard image_picker package, after picking (and automatic compression), the file became 4Mb and dimension 1280x1080. With the added line I mentioned, the picked file became 8Mb (so a slight compression, for some reason) but kept the original dimensions: 2727x2304.

It would be good to update the image_picker plugin because this automatic video compression on picking is troublesome and unexpected. But I'm not sure whether it's better to not compress videos at all (in order to have the same behavior as with Android), or to add a generral compression option, in which case we would have to add that option in Android as well to be consistent.

louisdeveseleer avatar Jan 04 '23 17:01 louisdeveseleer

It looks like there was a PR addressing this issue https://github.com/flutter/plugins/pull/3457

However, I still can't achieve the desired behavior of no compression on choosing a video from the gallery.

Just to echo what others have noticed: when I record a 4K/30fps video, I lose ~90% of the data through iOS compression, before uploading it to the final destination. The file size is changed, along with the dimensions.

Edit After reviewing the linked PR again, it seems that it was dropped in the end. So the topic is still open. I made the change locally to the package and the change works as expected. It was a single line as @louisdeveseleer suggested.

It is also very curious that this issue hasn't been brought up much more often since this package is used heavily and high quality videos are often worked with.

ramirezblindside avatar Feb 22 '23 08:02 ramirezblindside

@stuartmorgan Could you please advise what would be the best way ahead? I would not mind creating a PR, but I'm not sure if it's better to remove the compression altogether, to provide an ios-specific parameter, or to add the capability on android and have a cross-platform parameter.

louisdeveseleer avatar Feb 25 '23 13:02 louisdeveseleer

I'm not sure if it's better to remove the compression altogether

Unconditionally changing the system-default behavior, which the plugin has always had, would be a regression for many people.

to provide an ios-specific parameter

We would not want an "iOS-specific" parameter per se, but a parameter with a generic name like requestOriginalQuality that is documented to not apply to all platforms is something we do in many plugins (including this one already)

or to add the capability on android and have a cross-platform parameter.

Is there a way to request a pre-compressed/transcoded result in the relevant intent on Android? If so we should support it, if not it doesn't seem like there's any advantage in adding a lot of code to do one arbitrary implementation of that in the plugin itself when it could just add easily be done afterward with much more flexibility.

stuartmorgan-g avatar Feb 25 '23 14:02 stuartmorgan-g

I was wondering if there is already consensus in how Flutter plans to address the compression settings on iOS and if that's something we can expect to be implemented in the near future? It seem to me that the generic param: requestOriginalQuality that's implemented only on iOS (with a future possibility of different platforms support) is the way to go.

tomekit avatar Mar 18 '23 10:03 tomekit

Odd that there is no option to select the original video.

There is usually no problem with regular videos, but sometimes iPhone users may provide HEVC (H.265) videos shot in HDR. If this HEVC (H.265) video is converted directly to h264 SDR mp4, the resulting video may become whitish as there is no tone mapping applied. To prevent this, the part of the code that converts to mp4 was improved by examining the ios code of image_picker.

By looking at line 232 of packages/image_picker/image_picker_ios/ios/Classes/FLTImagePickerPlugin.m, it can be seen that the coding is done to convert to MP4:

 imagePickerController.mediaTypes = @[
   (NSString *)kUTTypeMovie, (NSString *)kUTTypeAVIMovie, (NSString *)kUTTypeVideo,
   (NSString *)kUTTypeMPEG4
 ];

Delete the code after (NSString *)kUTTypeMovie, as follows:

  imagePickerController.mediaTypes = @[(NSString *)kUTTypeMovie];

I am using this workaround, but I think we need an option to disable IOS compression and conversion

ioridev avatar Mar 27 '23 01:03 ioridev

I'm also waiting for this option to be able to disable compression since it causes the audio lost on the compressed video from HEVC format.

alexey-h avatar Apr 20 '23 22:04 alexey-h

The sad thing is pickMedia doesn't compress but doesn't allow you to filter.

ollyde avatar Jun 22 '23 15:06 ollyde

There is no audio in the result to (pickVideo(source: ImageSource.gallery) if I select a video that was edited before in the iOS media editor

eul avatar Oct 12 '23 11:10 eul

I have the same problem here, I use it to have users upload their videos, and a small portion of them have no sound in it, we really need either a fix (preferably) or the possibility to disable compression... To me it should be a higher priority than P3, as it's not just about compression, it's about losing the sound of some videos.

If it helps, here's the way too complicated workaround I use: I let the user pick a video, not to have a poor experience for all users while it's only in rare cases. Then, I detect if the uploaded video has sound, using this code:

import 'package:ffmpeg_kit_flutter/ffprobe_kit.dart';
...
Future<bool> hasAudio({required String videoPath}) async {
    final session = await FFprobeKit.getMediaInformation(videoPath);
    final information = session.getMediaInformation();

    if (information == null) {
      logWarning("Impossible to get video information");
      return true;
    }

    final hasAudio = information.getStreams().firstWhereOrNull((element) => element.getType() == "audio") != null;
    logVerbose("Video has audio: $hasAudio");
    return hasAudio;
  }

If the uploaded video has no sound, I display a message telling them we had an error on our side to the user, and asking them to pick the video again, but with the pickMedia() method, which disables compression. Then I double-check that the picked file is video, to display an error message if that's not the case, with that code:

import 'package:mime/mime.dart';

bool isVideo(String path) {
        String? mimeTypeString = lookupMimeType(path);
        final fileType = mimeTypeString?.split('/').firstOrNull;
        return fileType == "video"
}

benjamincombes avatar Nov 27 '23 10:11 benjamincombes

There is no audio in the result to (pickVideo(source: ImageSource.gallery) if I select a video that was edited before in the iOS media editor

I've encountered the same issue, and after numerous verifications, I've pinpointed that the problem is caused by the image_picker. It's been five years, and this fundamental issue still hasn't been resolved, which is truly disappointing.

rt234cw avatar Mar 30 '24 04:03 rt234cw

From what I can see, the video compression happening with ios can be disabled by adding the line imagePickerController.videoExportPreset = AVAssetExportPresetPassthrough; in the file FLTImagePickerPlugin.m at line 236 in the image_picker_ios package.

I tested with a .mov video, of original size 8.9Mb and dimension 2727x2304. With the standard image_picker package, after picking (and automatic compression), the file became 4Mb and dimension 1280x1080. With the added line I mentioned, the picked file became 8Mb (so a slight compression, for some reason) but kept the original dimensions: 2727x2304.

It would be good to update the image_picker plugin because this automatic video compression on picking is troublesome and unexpected. But I'm not sure whether it's better to not compress videos at all (in order to have the same behavior as with Android), or to add a generral compression option, in which case we would have to add that option in Android as well to be consistent.

This method is helpful! For those who are not sure how to follow it, here's a guide.

The path of FLTImagePickerPlugin.m is ios/.symlinks/plugins/image_picker_ios/ios/Classes/FLTImagePickerPlugin.m

UIImagePickerController *imagePickerController = [self createImagePickerController];
  imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
  imagePickerController.delegate = self;
  imagePickerController.mediaTypes = @[
    (NSString *)kUTTypeMovie,(NSString *)kUTTypeAVIMovie, (NSString *)kUTTypeVideo,
    (NSString *)kUTTypeMPEG4
  ];
  imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;

  //add this line to disable video compression
  imagePickerController.videoExportPreset = AVAssetExportPresetPassthrough;

rt234cw avatar Mar 30 '24 05:03 rt234cw

Any updates?

otopba avatar Aug 05 '24 17:08 otopba

From what I can see, the video compression happening with ios can be disabled by adding the line imagePickerController.videoExportPreset = AVAssetExportPresetPassthrough; in the file FLTImagePickerPlugin.m at line 236 in the image_picker_ios package. I tested with a .mov video, of original size 8.9Mb and dimension 2727x2304. With the standard image_picker package, after picking (and automatic compression), the file became 4Mb and dimension 1280x1080. With the added line I mentioned, the picked file became 8Mb (so a slight compression, for some reason) but kept the original dimensions: 2727x2304. It would be good to update the image_picker plugin because this automatic video compression on picking is troublesome and unexpected. But I'm not sure whether it's better to not compress videos at all (in order to have the same behavior as with Android), or to add a generral compression option, in which case we would have to add that option in Android as well to be consistent.

This method is helpful! For those who are not sure how to follow it, here's a guide.

The path of FLTImagePickerPlugin.m is ios/.symlinks/plugins/image_picker_ios/ios/Classes/FLTImagePickerPlugin.m

UIImagePickerController *imagePickerController = [self createImagePickerController];
  imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
  imagePickerController.delegate = self;
  imagePickerController.mediaTypes = @[
    (NSString *)kUTTypeMovie,(NSString *)kUTTypeAVIMovie, (NSString *)kUTTypeVideo,
    (NSString *)kUTTypeMPEG4
  ];
  imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;

  //add this line to disable video compression
  imagePickerController.videoExportPreset = AVAssetExportPresetPassthrough;

im commenting this, to reminds me eveytime i build...

adekmaulana avatar Sep 07 '24 13:09 adekmaulana