----------------------
This script does the following all in a single FFmpeg command execution:
- Rewrap container
- Generate hashcode of raw uncompressed video content
- Generate hashcode of raw uncompressed audio content
Same as what "frameMD5" or "frameCRC" are used for: Verify that transcoding/rewrapping was lossless.
Why not frameMD5 then?
It's easier to automate a comparison of a single hashcode per content type than diff-handling in automation.
Code: Select all
#!/bin/bash
# @author: Peter B. (pb@av-rd.com)
# @description:
# Rewraps container of source video, while generating 2 .md5 files with a
# single MD5 hashcode for the raw audio/video.
FIFO_A="audio"
FIFO_V="video"
# mkfifo $FIFO_A $FIFO_V
FFMPEG="ffmpeg-git"
VIDEO_IN="input.mov"
VIDEO_OUT="delme.mov"
CMD_FF="$FFMPEG -y -i $VIDEO_IN -map 0:1 -vn -f s16le audio -map 0:0 -an -f rawvideo video -c copy -map 0 $VIDEO_OUT"
# Audio hash:
CMD_HA="cat $FIFO_A | md5sum > $FIFO_A.md5"
# Video hash:
CMD_HV="cat $FIFO_V | md5sum > $FIFO_V.md5"
echo "$CMD_HA"
echo "$CMD_HV"
echo "$CMD_FF"
eval "$CMD_HA & $CMD_HV & $CMD_FF"
echo ""
echo "Audio MD5"; cat "$FIFO_A.md5"
echo "Video MD5"; cat "$FIFO_V.md5"
Thanks Keenan J. Troll for having the idea to do a "contentMD5"!