Introducing {mp4encoder} - an H.264/mp4 encoder for #RStats written in R itself!

https://github.com/coolbutuseless/mp4encoder

Features:
* Fast encoding e.g. 700fps for 800x600 native rasters
* Images may be RGB arrays or native rasters
* mp4 videos can be played on majority of OSs + browsers
* does not use 3rd party encoding libraries - meaning it will work anywhere you have R
* does all its encoding in R using {ctypesio} & {bitstreamio} for byte/bit manipulation

Caveat: it only writes uncompressed video

GitHub - coolbutuseless/mp4encoder: Encode h264 uncompressed video in mp4 container with R - low dependencies

Encode h264 uncompressed video in mp4 container with R - low dependencies - coolbutuseless/mp4encoder

GitHub

Videos created and encoded in #RStats with {mp4encoder}

https://github.com/coolbutuseless/mp4encoder

GitHub - coolbutuseless/mp4encoder: Encode h264 uncompressed video in mp4 container with R - low dependencies

Encode h264 uncompressed video in mp4 container with R - low dependencies - coolbutuseless/mp4encoder

GitHub

If you're at all interested, please kick-the-tyres on {mp4encoder} - I plan to put this on CRAN. #RStats

E.g.
* Do the created videos work on your OS?
* Works for me on macOS, firefox, chrome, vlc
* Do they work in VLC on your OS?
* Do they work in your main web browser?
* Can you easily re-encode them to more compressed forms (e.g. using Handbrake)

Pretty sure I could give an #PositConf2025 talk titled

"Bootstrapping and optimising an MP4 encoder in #RStats"

The talk would have an audience of one, and it'd be me. And I'm already there behind the podium.

Me-from-three-weeks-ago would also be pretty keen to attend.

@coolbutuseless will be a while before I'll have the opportunity but I'll do my best to remember to test; can test Ubuntu, Windows, and Android devices.
@coolbutuseless I'm on Android, on the Tusky Mastodon client. The one video that doesn't work is the 3rd one, that should show a grid of scatter plots (all I can see from the thumbnail, which is visible) - when I play it all I can see is green. I've had this problem with some YouTube videos in the past.

@spoltier interesting. This was working for me before I'm sure!

I'm not too sure what fosstodon is doing to the videos on the backend.

I have an idea on what might improve compatibility. Will investigate.

{mp4encoder} currently supports matrix, array and native raster images.

Do you have another #RStats image format you might want supported? Let me know!

My use case will largely be creating videos with native rasters and the {nara} package.

Currently I'm dumping images to PNG in realtime (via {fastpng}) and then assembling videos via ffmpeg.

This all gets a bit fiddly, especially when iterating quickly and making lots of temporary images and temporary videos to select a good one.

@coolbutuseless the informal outputs of vapour::gdal_raster_data vapour::gdal_raster_nara and those more formal of {gdalraster}::read_ds()

💪