HowTo generate single hashcode for A/V content

Step-by-Step descriptions of how to do things.

HowTo generate single hashcode for A/V content

Postby peter_b » Wed Jun 26, 2019 4:39 am

This script does the following all in a single FFmpeg command execution:

  1. Rewrap container
  2. Generate hashcode of raw uncompressed video content
  3. Generate hashcode of raw uncompressed audio content

Whatfor?
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"!
  • 0

User avatar
peter_b
Chatterbox
 
Posts: 302
Joined: Tue Nov 12, 2013 2:05 am
Reputation: 3

Return to HowTo's

Who is online

Users browsing this forum: No registered users and 7 guests

Who is online over last 24 hours

Users browsed this forum in the last 24 hours: No registered users and 28 guests

cron
Reputation System ©'