Pjmedia_codec_silk_init ( pjmedia_endpt *endpt) Line 36: Change to amr_header = str.Implementation of SILK codecs (narrow/medium/wide/superwide-band). Line 19: Change to silk_header = str.encode('#!SILK_V3') The latest python (3.7.0) has a different handling of byte/string compare/concat, so we need to encode strings to bytes before using them: Line 76: Change to output_file_name = input_file_name.replace(".amr", ".wav")įfmpeg prompts to overwrite, which is suppressed by the stdout/stderr overrides, so the script appears to hang but is just waiting for input. Line 72: Change to intermediate_file_2_name = input_file_name.replace(".amr", ".pcm") Line 62: Change to intermediate_file_1_name = input_file_name.replace(".amr", ".silk") amr, format remains the same, so we need to change the input extension: The latest wechat changed the extension from. I realize this project may never be updated, but want to add this comment as a reference for others who may need it. I found this script just now and used it to extract audio from the latest version of wechat (Android, wechat v.6.6.7), but had to make some changes to get it to work. Help = "Path to the SILK codec decoder program.") add_argument( "-s", "-silk-decoder", nargs = "?", default = "./decoder", add_argument( "Folder", action = Main, help = ".aud files root folder.") "modified from a tool originally for DEFT 8.") wav",Įpilog = "This script is an open source tool under the GNU GPLv3 license. ArgumentParser( description = ".aud converter: convert wechat.
"Try a shorter path to your input directory.")
"The SILK codec decoder also can't handle very large file paths. "The decoder (and its dependencies) must be in the specified path. "You may be missing the dependencies (ffmpeg and/or the SILK codec decoder). Print( "Something went wrong converting the audio files. silk_decoder, converted)Ĭonvert_amr_file( dirname, filename, converted) join( dirname, filename)Ĭonvert_silk_file( dirname, filename, namespace. # Decide which one of these are AMR files and which are SILK, and then convert.įor dirname, dirnames, filenames in os. "-i", intermediate_file_2_path, output_file_path],ĭef _call_( self, parser, namespace, values, option_string = None): # Use the SILK decoder to convert it to PCM Intermediate_file_2 = open( intermediate_file_2_path, 'wb') join( output_dir, intermediate_file_2_name) Intermediate_file_2_name = input_file_name. # WeChat adds a single extra byte before their SILK files. Intermediate_file_1 = open( intermediate_file_1_path, 'wb') join( output_dir, intermediate_file_1_name) Intermediate_file_1_name = input_file_name. # converted by stripping out the first byte and then using the SILK decoder. # These files are encoded with the SILK codec, originally developed by Skype.
Stdout = black_hole_file, stderr = black_hole_file)ĭef convert_silk_file( input_dir, input_file_name, decoder_file_path, output_dir): join( output_dir, output_file_name)īlack_hole_file = open( "black_hole", "w") Intermediate_file = open( intermediate_file_path, 'wb') join( output_dir, intermediate_file_name) Intermediate_file_name = input_file_name. Input_file = open( input_file_path, 'rb') # AMR file header and then converting from AMR to WAV. # These files are AMR files without the AMR header, so they can be converted by just adding the # WeChat adds an extraneous byte at the beginning of its SILK files for some reason.ĭef convert_amr_file( input_dir, input_file_name, output_dir): # If the file has a SILK file header, we know it's a SILK file. Nunes Adapted from another script by Nicodemo Gawronski os, argparse, subprocess # SILK audio codec decoder (available at )