Skip to content

Instantly share code, notes, and snippets.

@Pmmlabs
Created March 16, 2016 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pmmlabs/8e210e93a32fc12a8728 to your computer and use it in GitHub Desktop.
Save Pmmlabs/8e210e93a32fc12a8728 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Usage: $0 movie.mp4"
exit
fi
ffmpeg -loglevel quiet -i $1 -vcodec copy -vbsf h264_mp4toannexb -an -t 1 out.h264
echo $(h264_analyze out.h264 2>&1 | grep -B 6 SPS | head -n1 | cut -c 4- | xxd -r -p | base64)","$(h264_analyze out.h264 2>&1 | grep -B 5 PPS | head -n1 | cut -c 4- | xxd -r -p | base64)
rm -f out.h264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment