Skip to content

Instantly share code, notes, and snippets.

@Pmmlabs
Created May 28, 2018 21:08
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/4048b73fa6b0eadb85e2c5b84db2dc98 to your computer and use it in GitHub Desktop.
Save Pmmlabs/4048b73fa6b0eadb85e2c5b84db2dc98 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