0
\$\begingroup\$

My Unity3D game needs to play videos on mobile devices (using Handheld.PlayFullscreenMovie()). Seeking works badly. If I tap the video progress bar near the end (expecting it to play the last second then finish), playback jumps back a full 10-20 seconds, depending on the video. What should I try to make it easier for the player to seek within the file? Force additional key frames?

I'm currently encoding with HandbrakeCLI and the following settings:

--preset="AppleTV" --x264-tune=animation --x264-preset=veryslow
\$\endgroup\$
2
\$\begingroup\$

If you're using x264 encoding, your most likely problem is keyframes*. See this link and search for keyframe (it's the first thing there). Of course, you're not using FFmpeg, so you need the options for HandbrakeCLI, which seems to be "-x" command (a.k.a. --encopts) which receives a string, detailed here. Try those options out.

(--encopts "keyint=60" sets the maximum GOP size to 60 frames, which should make (at least) every 2 seconds searchable for a 30FPS video but that would also mean much lower compression)

*Keyframes are used for compression and you can only search between keyframes in a x264 compression (Jump from one keyframe to another). It is most likely a really high number by default for extreme compression.

\$\endgroup\$
  • 1
    \$\begingroup\$ Thanks, that did it. But the option name has changed, and the syntax is wrong--HandbrakeCLI uses the same syntax for its long and short options. I hope you don't mind if I edit your answer. \$\endgroup\$ – piojo Dec 7 '16 at 3:01
  • \$\begingroup\$ Yeah, it's cool. I don't really have any experience with HandlebrakeCLI, so your edit is more than welcome. \$\endgroup\$ – John Hamilton Dec 7 '16 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.