Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
wiki:scripts_and_tools [2011/06/18 09:35] – move region script 217.85.106.127 | wiki:scripts_and_tools [2012/04/09 22:37] – [convert sound files with libsndfile] emrum | ||
---|---|---|---|
Line 5: | Line 5: | ||
. | . | ||
+ | |||
+ | ==== wav file to specimen bank (sampler format) script ==== | ||
+ | |||
+ | * see here: [[/ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | ==== lscp2rgd - linuxsampler to rosegarden instrument ==== | ||
+ | |||
+ | * see: [[/ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ==== midi to hydrogen ==== | ||
+ | |||
+ | * [[/ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ==== script: create a hydrogen drumkit from wav files === | ||
+ | |||
+ | thanks to Thijs van Severen | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | \\ | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | \\ | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | \\ | ||
+ | |||
==== aj-snapshot - Store ALSA and JACK connections state ==== | ==== aj-snapshot - Store ALSA and JACK connections state ==== | ||
Line 107: | Line 143: | ||
. | . | ||
- | === convert sound files with libsndfile === | + | ==== convert sound files with libsndfile |
- | sndfile-convert | + | |
+ | === convert all FLAC files in a directory to OGA format (vorbis-encoded stream in ogg-container) === | ||
+ | \\ | ||
+ | ** Note: ** There is a simple and excellent GUI tool available for audio conversion: [[http:// | ||
+ | It is included in the ubuntu repository. | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | <code bash> | ||
+ | # | ||
+ | |||
+ | ## UPDATE: | ||
+ | ## there are no options to control that, or compression rate. | ||
+ | ## so rather use " | ||
+ | ## there is also a py-script called " | ||
+ | |||
+ | # initial code by Emanuel Rumpf 2012-04 | ||
+ | # any re-use and modification permitted | ||
+ | |||
+ | # convert all FLAC files in a directory to OGA format | ||
+ | # (compressed, | ||
+ | # | ||
+ | # USAGE: | ||
+ | # first install libsndfile - in ubuntu: | ||
+ | # sudo | ||
+ | # | ||
+ | # copy this script to the files directory, make it executable | ||
+ | # edit config options below if necessary, run it | ||
+ | |||
+ | # TODO: allow file-names with spaces | ||
+ | |||
+ | |||
+ | # CONFIGURE HERE | ||
+ | |||
+ | # select file extension: | ||
+ | EXT_OLD=" | ||
+ | EXT_NEW=" | ||
+ | |||
+ | # select directory for new vfiles | ||
+ | OUT_DIR=" | ||
+ | |||
+ | # add -vorbis parameter to sndfile-convert call | ||
+ | CONVERT_OPT=" | ||
+ | |||
+ | |||
+ | # CODE START | ||
+ | |||
+ | mkdir -p " | ||
+ | |||
+ | # apply to all flac files in current directory | ||
+ | FILES=*${EXT_OLD} | ||
+ | |||
+ | for f in $FILES | ||
+ | do | ||
+ | |||
+ | fn=`basename " | ||
+ | fn=" | ||
+ | |||
+ | comm=" | ||
+ | echo " | ||
+ | $comm | ||
+ | echo "" | ||
+ | |||
+ | done | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | </ | ||
+ | \\ | ||
+ | \\ | ||
+ | < | ||
+ | # There is a possilbe alternative, | ||
+ | # | ||
+ | # warning: this is not verbose | ||
+ | |||
+ | |||
+ | # for all files in current directory (.) execute libsndfile-convert | ||
+ | # | ||
+ | find . -name " | ||
+ | |||
+ | </ | ||
. | . | ||
Line 160: | Line 277: | ||
==== spaces to underscores ==== | ==== spaces to underscores ==== | ||
- | < | + | < |
#! /bin/bash | #! /bin/bash | ||
# | # | ||
Line 188: | Line 305: | ||
. | . | ||
+ | |||
+ | |||
+ | ==== Extract Audio from Video and recombine ==== | ||
+ | (help by Robin Gareus @lau-ml) | ||
+ | |||
+ | === with ffmpeg === | ||
+ | |||
+ | < | ||
+ | |||
+ | #extract audio | ||
+ | ffmpeg -i orig_video.wmv audio_out.wav | ||
+ | |||
+ | #replace audio | ||
+ | ffmpeg \ | ||
+ | -i orig_video.wmv \ | ||
+ | -i new_audio.wav \ | ||
+ | | ||
+ | -map 0.0 -map 1.0 \ | ||
+ | | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | < | ||
+ | Details: | ||
+ | run `ffprobe` to see which is the video-track in the .wmv file | ||
+ | usually this is " | ||
+ | | ||
+ | | ||
+ | and " | ||
+ | |||
+ | You may want to add " | ||
+ | Windows Media Audio 2 or whatever audio-codec/ | ||
+ | -codecs | grep " | ||
+ | Audio. | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | BTW. Ardour3 with videotimeline patch can do all this for you. | ||
+ | import, | ||
+ | |||
+ | |||
+ | |||
+ | >> Thanks. It is 0:0 and 0:1 and -b:a=192k I found, but I have some sync problems after recombining tho. Any other ideas? | ||
+ | |||
+ | My gut feeling is to blame ffmpeg' | ||
+ | a bit-exact copy of the original video with your new soundtrack). | ||
+ | |||
+ | < | ||
+ | |||
+ | Try using ' | ||
+ | same quality rather than a bit-exact copy - this often solves muxing | ||
+ | issues but will cause a small loss of either video quality or increased | ||
+ | bandwidth). | ||
+ | |||
+ | </ | ||
+ | |||
+ | and also try a different output format eg. ' | ||
+ | instead of ' | ||
+ | |||
+ | < | ||
+ | |||
+ | you may need both, this should work: | ||
+ | ' | ||
+ | |||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | === with mencoder === | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | \\ | ||
+ | |||
+ | === posssibly other options === | ||
+ | |||
+ | \\ | ||
+ | * kdenlive | ||
+ | * ardour3 + video patch | ||
+ | |||
+ | \\ | ||
+ | |||
+ | \\ | ||
+ | |||
==== Tips ==== | ==== Tips ==== |