.a.gif
)"Sounds Like a Bad Idea."
TL;DR: An Audio GIF stores audio inside a standards compliant Animated GIF image.
Save As...
on the Animated GIF image file and the audio comes along for the ride.ffmpeg
to be installed first.This can probably done as a one-liner but this way we can check we've cropped/shortened correctly first.
ffmpeg -ss MM:SS.mm -t SS.mm -i input_video.mp4 -vf "crop=out_w=660:out_h=522:x=250:y=0" -c:a aac -map 0:v -map 0:a my_new.mp4
ffmpeg -ss MM:SS.mm -t SS.mm -i input_video.mp4 -ar 22050 -ac 1 my_new.wav
Note: The gif-encoder.sh
script has some hardcoded values you may wish to change.
tools/gif-encoder.sh my_new.mp4 my_new.gif
kaitaistruct
runtime library for Python to be installed first.tools/gif-audio-add.py my_new.gif my_new.wav
Creates a new file named my_new.a.gif
which is the recommend file extension for Audio GIFs.
You might like to ask your favourite software to add support for the Audio GIF format.
"Audio for GIF" Application Extension (a.k.a Audio GIF) Specification v0.1
[0x21] Extension Introducer
[0xFF] Extension Label (Standard: "Application Extension")
[0x0B] Block Size (Standard: There are 11 bytes before application data)
[0x41][0x55][0x44][0x49][0x4F][0x47][0x49][0x46] Application Identifier ("AUDIOGIF")
[0x30][0x2E][0x31] Application Authentication Code ("0.1")
[0x01] Block Size (New: Audio Metadata Sub-Block)
[0x01] Audio Data Format (New: 0x00 == Reserved (for WebAudio native format) 0x01 == Determine format by introspection--not implemented assumes .wav))
[Subblock Length][Subblock Data] N * Blocks of Audio (file) data.
[0x00] Empty sub-block marks end of audio data. (Standard)
See tools/gif-audio-add.py
in this repository. The Reference Implementation Encoder builds on the work of https://ffmpeg.org/ and http://kaitai.io/.
See thirdparty/gifuct-js
in this repository. The Reference Implementation Player is based on https://github.com/matt-way/gifuct-js with Audio GIF functionality added. I chose gifuct-js
because it was the easiest to modify JavaScript GIF library that I found.
But why?
Because sounds like a bad idea. :)
[TODO]
The Audio GIF is brought to you by http://RancidBacon.com/.