Last active
September 11, 2017 19:48
-
-
Save dhfromkorea/9ea3f13ba4e5fb7c26a673c41f563726 to your computer and use it in GitHub Desktop.
audiofingerprinting example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fp = FingerPrint(path_to_dejavu_config_file) | |
timestamp_pb = 20000 # program boundary timestamp in secs from | |
PAD = 10 # temporal padding to apply to the timestamp | |
# slice an audio segement off the video | |
fp.slice_audio_segment(path_to_full_video_or_audio, pb - PAD, pb + PAD, "mp4") | |
# extract the fingerprint of the segment and save it to db | |
# db's configured in the .config file | |
# the path for the full video/audio and the segment may be different | |
# by default mp3 file in the path will be automatically picked up | |
fp.extract_fingerprint_single(path_to_full_video_or_audio) | |
# song once extracted must be recognized | |
song = self.fp.recognize_audio(path_to_full_video_or_audio) | |
# example output: notice the confidence score | |
# { | |
# 'song_id':7, | |
# 'song_name':'audio_seg', | |
# 'offset_seconds':0.0, | |
# 'offset':0, | |
# 'confidence':7881, | |
# 'file_sha1':'C14D20D1EFBD719E10757E59027177A7315A77E7', | |
# 'match_time':2.5015318393707275 | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment