Kindle Video Playback Hack
Prerequsite
- The Kindle needs to be jailbroken.
- Terimnal access on Kindle (Kterm or SSH)
- Generate a directory to store all temporary files on Kindle, using
/mnt/us/demo/for example in this tutorial.
- Generate a directory to store all temporary files on Kindle, using
Slice Video Frames
i=INPUT.mp4; w=1236; h=1648;
# Adjust resolution accordingly:
# - Kindle Paperwhite (11th gen.): 1236x1648
# - Kindle Paperwhite (12th gen.): 1264×1680
# - Kindle Colorsoft: 1264×1680
mkdir -p ./frames && ffmpeg -i "$i" \
-vf "transpose=1,\
scale=$w:$h:force_original_aspect_ratio=decrease,\
pad=$w:$h:(ow-iw)/2:(oh-ih)/2,\
format=gray" \
-r 5 ./frames/frames_%04d.png
Copy all PNG images (the frames folder) to Kindle, put under /mnt/us/demo/.
Transcode Audio
Export raw PCM audio (Signed 16-bit Little-Endian, 44100 Hz, Stereo):
i=INPUT.mp4;
ffmpeg -i "$i" -f s16le -acodec pcm_s16le -ar 44100 -ac 2 audio.raw
Copy the PCM file audio.raw to Kindle, put under /mnt/us/demo/.
E-Ink Refreshing Control
-
Download FBInk source code from https://github.com/NiLuJe/FBInk/releases.
-
Install cross-compiling tools via HomeBrew:
brew tap messense/macos-cross-toolchains brew install messense/macos-cross-toolchains/armv7-unknown-linux-gnueabihf -
Compile FBink for Kindle: change directory to the root directory of FBInk source code, and run the code snippet to start compiling.
make clean make KINDLE=1 \ CROSS_COMPILE=armv7-unknown-linux-gnueabihf- \ CC=armv7-unknown-linux-gnueabihf-gcc \ STATIC=1 \ STB_IMAGE=1 \ static -
Copy and paste the binary file
fbinkof FBink under the folder./Release/to Kindle, put under/mnt/us/demo/.
Shell Script
Run on kindle to orchestrate the “video” playback, put under /mnt/us/demo/.
Shell Script Template:
#!/bin/sh
# 1. Pause Kindle UI
stop framework
# 2. Force refreshing e-ink (-c: clear display, -W GC16: Grayscale Clear 16-level Waveform)
/mnt/us/demo/fbink -q -c -f -W GC16
# 3. Play audio and frames
gst-launch-0.10 -q filesrc location=/mnt/us/demo/audio.raw ! \
"audio/x-raw-int,endianness=(int)1234,signed=(boolean)true,width=(int)16,depth=(int)16,rate=(int)44100,channels=(int)2" ! \
mixersink &
AUDIO_PID=$!
for img in /mnt/us/demo/frames/*.png; do
/mnt/us/demo/fbink -q -f -W A2 -g file="$img"
done
kill -9 $AUDIO_PID 2>/dev/null
# 4. Restore Kindle UI
start framework
To start the “video” playback, simply connect the Kindle to a Bluetooth audio device, and run the shell script, named as play_demo for example in this tutoial.
chmod +x /mnt/us/demo/fbink /mnt/us/demo/play_demo.sh
/mnt/us/demo/play_demo.sh
Demo
- Bilibili: https://www.bilibili.com/video/BV1Rqhw6CEaz/
- YouTube: