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

Filename's contains special characters that are not handled properly by other libraries #203

Open
jpetro416 opened this issue Apr 28, 2023 · 0 comments

Comments

@jpetro416
Copy link

jpetro416 commented Apr 28, 2023

Filename's contains special characters that are not handled properly by other libraries. For example, the colon character (:) as well as a comma "," in the filename is causing issues with the compression libs out there, as it's not a valid character in a file name on some operating systems.

Compression lib trying to access the file generated from:

 await _trimmer.saveTrimmedVideo(
      startValue: _startValue,
      endValue: _endValue,
      onSave: (outputPath) {  

Error:

Fatal error while transcoding, this might be invalid format or bug in engine or Android.
E/Transcoder( 4788): java.lang.IllegalArgumentException: could not access /data/user/0/com.myapp.app/app_flutter/Trimmer/tuts_map_trimmed:Apr28,2023-09:45:54.mp4
E/Transcoder( 4788): 	at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:370)

Code in video_trimmer that needs to be changed:
videoFileName ??= "${videoName}_trimmed:$formattedDateTime";
Recommendation:
videoFileName ??= "${videoName}_trimmed_$formattedDateTime";

    formattedDateTime = formattedDateTime.replaceAll(':', '_');
    videoFileName = videoFileName.replaceAll(' ', '_');
    videoFileName = videoFileName.replaceAll(',', '_');
    videoFileName = videoFileName.replaceAll(':', '_');
    videoFileName = videoFileName.replaceAll('-', '_');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant