Thanks! I should keep up with this thread with some things I've found recently. We've needed to add some additional audio filters to handle certain input streams, the audio filter portion we're testing looks like:
-ac 1 -acodec pcm_u8 -af "volume=0.0dB,aresample=10000,aresample=async=1000,aresample=osf=u8,asetnsamples=n=210:p=0"
The asetnsamples is the important part, 210 is a somewhat arbitrary value that results in about 2 chunks of samples per video frame, which the TV firmware can easily consume. Typically ffmpeg does something like that with the average mp4 input, but some inputs can result in huge chunks of audio spanning many frames, which the TV firmware can't handle.
Somewhat unexpectedly, the conversion to 8 bit seems to lower amplitude on some streams, so it seems like we need to run volumedetect on a resampled stream, for example:
ffmpeg -i input.mp4 -vn -ac 1 -af "aresample=10000,aresample=async=1000,asetnsamples=n=210:p=0,aresample=osf=u8,volumedetect" -f null /dev/null
The absolute value of the peak output value can replace the 0.0dB in the first snippet to normalize the way that
https://github.com/slhck/ffmpeg-normalize does peak normalization. This seems to get things peak normalized without clipping in the testing we've done.
We do plan to get this integrated into the app but I'm not sure exactly when!