I have some 1080p videos that I'd like to convert to x265 to reduce their size.

The problem is that when I convert them using ffmpeg, I have problems playing the resulting video on Kodi running on Raspberry Pi 4. Either video or audio freezes at certain specific times. I haven't encountered such issues with other x265 1080p videos. (And RPi4 has native HEVC hardware decoding, which allows it to play even high-res x265 video without issues.)

I use

  • -c:v libx265 -crf 29 -preset slow for video

and for audio

  • -c:a libopus -b:a 160k -af channelmap=channel_layout=5.1
  • -c:a libopus -b:a 112k

for different audio channels. For this reason also I need to encode such 2 audio tracks separately and then mux them together.

I tried (separately):

  • Reduce the maximum rate by -maxrate 3M -bufsize 6M to make sure there aren't VBR parts with too much data to process,
  • -tune fastdecode,
  • Adding -filter:a aresample=async=1000.

But neither worked. (I haven't tried combining these options together.)

What could be a cause of these issues and what else can I try?

Update: I changed my workflow to encode all channels at once using -filter:a:0 'channelmap=channel_layout=5.1'. This fixed the problem. Which means, it was apparently caused by remuxing the channels. But still I have no idea why.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.