cdgriffith / FastFlix

FastFlix is a free GUI for H.264, HEVC and AV1 hardware and software encoding!
https://fastflix.org/
MIT License
1.12k stars 55 forks source link

Add aac_at for aac codec selection #259

Closed alpha-0 closed 2 years ago

alpha-0 commented 2 years ago

I found no way to change the audio conversion to aac_at instead of aac (vbr). I had tried adding line(- aac_at) on sane_audio_selection section of the config file but it couldn't help.

I want to encode a quicktime compatible mp4 file and I already change the output file extension to mp4. But I found the default aac (vbr) is incompatible with quicktime player on mac, making that the quick look(preview) in finder.app couldn't play the video and only show an icon instead.

cdgriffith commented 2 years ago

Odd that adding it to the sane audio didn't work. You could try disabling it for now to see if it shows up in the full list (File > Settings > Uncheck "Use Sane Audio Selection") and see if it shows up.

If not, it probably doesn't appear when using the command ffmpeg -hide_banner -encoders try running:

ffmpeg -hide_banner -encoders | grep aac

And see if it's listed as an option.

alpha-0 commented 2 years ago

Thank you for your reply!

I had tried uncheck "Use Sane Audio Selection" but still no aac_at option there.

The below is the output of the command "ffmpeg -hide_banner -encoders | grep aac" A..... aac AAC (Advanced Audio Coding) A..... aac_at aac (AudioToolbox) (codec aac) They both share the same name "aac".

cdgriffith commented 2 years ago

Thank you for the output. And that is so weird, the logic is encoders.append(line.strip().split(" ")[1]) aka it splits on the spaces and grabs the second object, which should be acc and acc_at in that example case.

Just making double sure, you don't happen to have multiple ffmpeg versions? aka make sure the full path in File > Settings is the same as what you get if you run which ffmpeg on the command line.

alpha-0 commented 2 years ago

I had retried using the full path of ffmpeg as the same one in the setting. And I got the same output. I try to paste the output here again with space character replaced with   so the spaces wouldn't be trimmed.  A..... aac                  AAC (Advanced Audio Coding)  A..... aac_at               aac (AudioToolbox) (codec aac)

alpha-0 commented 2 years ago

Is leading space matter for the logic encoders.append(line.strip().split(" ")[1])? I tried string.split(" ") in some python code with my output and got aac_at at element 2 instead of element 1. Then I removed the separater argument, i.e. string.split() and got aac_at at element 1. The leading space of line was skipped and multiple spaces were counted as single separator.

separator - Optional. Specifies the separator to use when splitting the string. By default any whitespace is a separator.

alpha-0 commented 2 years ago

I am sure the original logic encoders.append(line.strip().split(" ")[1]) works.

And then I found out a temporary solution by modifying self.widgets.convert_to.addItems(sorted(set(self.available_audio_encoders) & set(codec_list))) to self.widgets.convert_to.addItems(sorted(set(self.available_audio_encoders) | set(codec_list))) in widgets/panels/audio_panel.py.

But I don't know how to fix the problem along both list of encoders and list of codecs yet.

cdgriffith commented 2 years ago

Thank you for looking into this more. I completely forgot that each encoder has a list of audio codec formats it's known to support. i.e. https://github.com/cdgriffith/FastFlix/blob/master/fastflix/encoders/hevc_x265/main.py#L19

I will look at simply nixxing that, as the "sane" audio list has been added anyways, and if people want something else they should be able to try anything without this trying to keep track of new audio codecs being added / platform specific ones.

cdgriffith commented 2 years ago

In latest 4.4.0 should allow you to now use any audio encoder FFmpeg has available if you don't have "sane audio" selected :)

There will be cases where the container used (mp4 / mkv / webm) may not usually support the type of audio used and need to add -strict -2 to the custom ffmpeg options to squeeze it in. (Not usually a good idea as not much will play it, but possible.)

If this doesn't fix it for you, let me know and can re-open!