caydey / ffshare

An android app to compress image, video and audio files through ffmpeg before sharing them
GNU General Public License v3.0
575 stars 25 forks source link

Customize ffmpeg commands #27

Open YellowOnion opened 1 year ago

YellowOnion commented 1 year ago

Currently the settings make far too many assumptions and are extremely brittle.

I'm pretty sure the current defaults settings are outright wrong, because I can't even get any output at the moment, and the use of some commands don't look correct for a casual ffmpeg user myself.

  1. Scaling is borked

    1. H.264 requires divisible by 2 resolutions, that means that the -vf scale=-1:720 command just won't work 100% of the time especially for large downscaling, like with portrait videos (405x720)
    2. This command doesn't support portrait video recordings nicely, you should end up with 720x1280 videos.
    3. don't use format as a separate filter chain, there's literally an error saying it will be ignored.
    4. Because ffmpeg applies the display matrix during output scaling (portrait video from a phone is still 16:9 with a metadata telling the player to apply a rotation), it's probably better to use a high quality upscaler like lanczos to stop the chroma sub sampling getting worse, and it's not that expensive CPU wise.
    5. the full filter chain should probably look like this and should cover most common use cases and give sane output [doc]
    -vf scale=720:720:force_original_aspect_ratio=increase:force_divisible_by=2:flags=lanczos:out_range=tv,format=yuv420p,setsar=1/1
  2. use libx264 explicitly, not implicitly, -c:v libx264 don't relying on ffmpeg keeping the "h264" defaulting to libx264, especially when using codec specific settings like -crf, I get errors about incompatible muxer stuff, which is probably related to this.

  3. Don't ruin my audio, just issue -c:a copy, transcording always hurts quality, even increasing the bitrate, and is a waste of precious battery life, this should be the default when input audio AAC, and we don't want lower bitrate.

  4. mp4 is a shit output format, put -movflags faststart to make it slightly less shit.

  5. expose the x264 presets as a menu option / profile, the x2 speed increase for settings like veryfast is definitely worth in in some situations

  6. Please let us use custom settings, especially for x264, I love the denoiser but I know it's not everyones cup of tea.

gbdomubpkm commented 1 year ago

This issue seems essential to allow compression in the format you choose. At the moment, we (I) don't really understand why sometimes compression works or not in the format I want. Only this one, could it be fixed?

gbdomubpkm commented 1 year ago

@caydey Hello. Glad to see you back. I hope you had personal success during your period of absence. Regarding your app, it is indeed essential and as a feedback after a year, I am very satisfied with it. Sometimes indeed, the compression does not launch whatever the output resolution format chosen, or it launches at a certain output format: a mystery (probably not for you). Anyway, any improvements and bug fixes will be welcome and a big thank you again !

Edit : the most frequent problems are when I want to convert a 1080p file to whatever lower resolution. The conversion fails on startup.

MeltyObserver commented 3 months ago

any update on this issue? I like the app but I'd love to be able to use my own ffmpeg command. maybe add it under an "advanced" label?

Noitarud commented 1 month ago

any update on this issue? I like the app but I'd love to be able to use my own ffmpeg command. maybe add it under an "advanced" label?

Isn''t that under "custom parameters"?

MeltyObserver commented 1 month ago

yeah this was implemented in v1.3.0 (2 days after my comment) but i guess the developer forgot to close this issue

@caydey

caydey commented 1 month ago

I've left the issue open because although it mentions customising ffmpeg commands, that is not the main area in the issue with other important comments that can be seen by reading past the title