-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UPDATE] fixed that fail when filename contains special chars like \' "
- Loading branch information
1 parent
387f7b9
commit 8e55ad4
Showing
8 changed files
with
130 additions
and
8 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# author: Kevin T. Lee<[email protected]> | ||
# description: DJ-beat is available to detect the beat from the audio and generate time marks for FCPX and premiere. | ||
|
||
__version__ = '0.4.7' | ||
__version__ = '0.4.9' | ||
|
||
import madmom | ||
import librosa | ||
|
@@ -11,6 +11,7 @@ | |
import os | ||
import datetime | ||
import numpy as np | ||
import re | ||
from tqdm import tqdm | ||
from pyfiglet import Figlet | ||
from string import Template | ||
|
@@ -54,7 +55,7 @@ def proc_data(self): | |
self.file_time = (1.0 * len(self.y) / self.audio_sr) | ||
self.file_real_length = int(self.file_time * 1000) | ||
self.file_length = int(self.file_time) * 1000 | ||
proc = madmom.features.beats.DBNBeatTrackingProcessor(fps=self.fps) | ||
proc = madmom.features.beats.DBNBeatTrackingProcessor(look_ahead=0.4, fps=self.fps) | ||
act = madmom.features.beats.RNNBeatProcessor()(self.filepath) | ||
|
||
beat_times = proc(act) | ||
|
@@ -76,10 +77,11 @@ def gen_fcpxml(self): | |
|
||
self.beat_marks = '\n'.join(markers) | ||
|
||
new_file_name = re.sub(r'\W','_',self.file_name) | ||
_dict = {'build_version': self.build_version, | ||
'date_time': self.date_time, | ||
'frame_rate': self.frame_rate, | ||
'file_name': self.file_name, | ||
'file_name': new_file_name, | ||
'file_path': pathname2url(self.abs_filepath), | ||
'file_length': self.file_length, | ||
'file_real_length': self.file_real_length, | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE fcpxml> | ||
|
||
<fcpxml version="1.8"> | ||
<resources> | ||
<format id="r1" name="FFVideoFormat1080p30" frameDuration="100/3000s" width="1920" height="1080" colorSpace="1-1-1 (Rec. 709)"/> | ||
<asset id="r2" name="中文 测试"" uid="F554540157F2DDDD141252517F34AA6E" src="file:///Users/kevin/Projects/GitHub/dj-beat/test/%E4%B8%AD%E6%96%87%20%E6%B5%8B%E8%AF%95%22.wav" start="0s" duration="241531/44100s" hasAudio="1" audioSources="1" audioChannels="2" audioRate="44100"> | ||
<bookmark>Ym9vazQDAAAAAAQQMAAAAGmRsqvaJ4K/qcAGPjgdMvst076Mb9cX1iFox0ENEVbpMAIAAAQAAAADAwAAABgAKAUAAAABAQAAVXNlcnMAAAAFAAAAAQEAAGtldmluAAAACAAAAAEBAABQcm9qZWN0cwYAAAABAQAAR2l0SHViAAAHAAAAAQEAAGRqLWJlYXQABAAAAAEBAAB0ZXN0EgAAAAEBAADkuK3mlocg5rWL6K+VIi53YXYAABwAAAABBgAAEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAbAAAAAgAAAAEAwAAo2cGAAAAAAAIAAAABAMAALWlCQAAAAAACAAAAAQDAAA22xoAAQAAAAgAAAAEAwAAEU1VAQEAAAAIAAAABAMAANShRAIBAAAACAAAAAQDAADUokQCAQAAAAgAAAAEAwAAoEa8AgEAAAAcAAAAAQYAAKwAAAC8AAAAzAAAANwAAADsAAAA/AAAAAwBAAAIAAAAAAQAAEHBX5gR4RSYGAAAAAECAAABAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAIAAAABAMAAAUAAAAAAAAABAAAAAMDAAD1AQAACAAAAAEJAABmaWxlOi8vLwwAAAABAQAATWFjaW50b3NoIEhECAAAAAQDAAAAoCBodAAAAAgAAAAABAAAQb6DYoIAAAAkAAAAAQEAADBENjJCNzdELUQ1RkItMzQzQy05NzYyLTg0NzdDQTFCQzk1QRgAAAABAgAAgQAAAAEAAADvEwAAAQAAAAAAAAAAAAAAAQAAAAEBAAAvAAAAAAAAAAEFAADMAAAA/v///wEAAAAAAAAAEAAAAAQQAACIAAAAAAAAAAUQAAAcAQAAAAAAABAQAABQAQAAAAAAAEAQAABAAQAAAAAAAAIgAAAcAgAAAAAAAAUgAACMAQAAAAAAABAgAACcAQAAAAAAABEgAADQAQAAAAAAABIgAACwAQAAAAAAABMgAADAAQAAAAAAACAgAAD8AQAAAAAAADAgAAAoAgAAAAAAAAHAAABwAQAAAAAAABHAAAAgAAAAAAAAABLAAACAAQAAAAAAABDQAAAEAAAAAAAAAA==</bookmark> | ||
</asset> | ||
</resources> | ||
<library location="file:///Users/kevin/Movies/Kevin.fcpbundle/"> | ||
<event name="treasure-trimed Event" uid="7A9FF238-349D-4B45-BC12-4DFB9BC87747"> | ||
<project name="treasure-trimed Project" uid="A1409274-B5B3-4B99-ADCA-39AC09FC04ED" modDate="2019-07-03 13:45:07 +0800"> | ||
<sequence duration="16400/3000s" format="r1" tcStart="0s" tcFormat="NDF" audioLayout="stereo" audioRate="48k"> | ||
<spine> | ||
<asset-clip name="中文 测试"" offset="0s" ref="r2" duration="16400/3000s" audioRole="dialogue"> | ||
<marker start="395519/240000s" duration="1/48000s" value="Marker 3"/> | ||
<marker start="1743283/720000s" duration="1/48000s" value="Marker 1"/> | ||
<marker start="141837/40000s" duration="1/48000s" value="Marker 2"/> | ||
</asset-clip> | ||
</spine> | ||
</sequence> | ||
</project> | ||
</event> | ||
<smart-collection name="项目" match="all"> | ||
<match-clip rule="is" type="project"/> | ||
</smart-collection> | ||
<smart-collection name="所有视频" match="any"> | ||
<match-media rule="is" type="videoOnly"/> | ||
<match-media rule="is" type="videoWithAudio"/> | ||
</smart-collection> | ||
<smart-collection name="仅音频" match="all"> | ||
<match-media rule="is" type="audioOnly"/> | ||
</smart-collection> | ||
<smart-collection name="静止图像" match="all"> | ||
<match-media rule="is" type="stills"/> | ||
</smart-collection> | ||
<smart-collection name="个人收藏" match="all"> | ||
<match-ratings value="favorites"/> | ||
</smart-collection> | ||
</library> | ||
</fcpxml> |
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE fcpxml> | ||
|
||
<!-- DJ-beat @2019 Kevin T. Lee - Build Version: 0.4.8 --> | ||
<!-- Build Date Time: 2019-07-03 14:37 --> | ||
|
||
<fcpxml version="1.6"> | ||
<resources> | ||
<format id='k1' name='FFVideoFormat1080p30' frameDuration='1/30s'/> | ||
<asset id="k2" name="中文_测试________" src="file:/Users/kevin/Projects/GitHub/dj-beat/test/%E4%B8%AD%E6%96%87%20%E6%B5%8B%E8%AF%95%22%24%23%26%2A%5E%21%7E.wav" start='0/1000s' duration='5476/1000s' hasAudio="1" audioSources="1" audioRate="22050"> | ||
</asset> | ||
</resources> | ||
<library> | ||
<event name="中文_测试________ Event"> | ||
<project name="中文_测试________ Project"> | ||
<sequence duration='5000/1000s' format="k1" tcStart="0s" tcFormat="NDF" audioLayout="stereo" audioRate="48k"> | ||
<spine> | ||
<asset-clip name='中文_测试________' lane='0' offset='0/1000s' ref='k2' duration='5000/1000s' audioRole='Music'> | ||
<marker start='7/30s' duration='1/48000s' value='beat_at_0.25' completed='0'/> | ||
<marker start='23/30s' duration='1/48000s' value='beat_at_0.77' completed='0'/> | ||
<marker start='38/30s' duration='1/48000s' value='beat_at_1.28' completed='0'/> | ||
<marker start='54/30s' duration='1/48000s' value='beat_at_1.8' completed='0'/> | ||
<marker start='69/30s' duration='1/48000s' value='beat_at_2.32' completed='0'/> | ||
<marker start='85/30s' duration='1/48000s' value='beat_at_2.84' completed='0'/> | ||
<marker start='100/30s' duration='1/48000s' value='beat_at_3.35' completed='0'/> | ||
<marker start='116/30s' duration='1/48000s' value='beat_at_3.87' completed='0'/> | ||
<marker start='131/30s' duration='1/48000s' value='beat_at_4.39' completed='0'/> | ||
<marker start='147/30s' duration='1/48000s' value='beat_at_4.91' completed='0'/> | ||
<marker start='162/30s' duration='1/48000s' value='beat_at_5.42' completed='0'/> | ||
|
||
<audio-channel-source role='music.music-1' srcCh='1, 2'/> | ||
</asset-clip> | ||
|
||
</spine> | ||
</sequence> | ||
</project> | ||
</event> | ||
</library> | ||
</fcpxml> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE fcpxml> | ||
|
||
<!-- DJ-beat @2019 Kevin T. Lee - Build Version: 0.4.8 --> | ||
<!-- Build Date Time: 2019-07-03 13:46 --> | ||
|
||
<fcpxml version="1.6"> | ||
<resources> | ||
<format id='k1' name='FFVideoFormat1080p30' frameDuration='1/30s'/> | ||
<asset id="k2" name="中文 测试"" src="file:/Users/kevin/Projects/GitHub/dj-beat/test/%E4%B8%AD%E6%96%87%20%E6%B5%8B%E8%AF%95%22.wav" start='0/1000s' duration='5476/1000s' hasAudio="1" audioSources="1" audioRate="22050"> | ||
</asset> | ||
</resources> | ||
<library> | ||
<event name="中文 测试" Event"> | ||
<project name="中文 测试" Project"> | ||
<sequence duration='5000/1000s' format="k1" tcStart="0s" tcFormat="NDF" audioLayout="stereo" audioRate="48k"> | ||
<spine> | ||
<asset-clip name='中文 测试"' lane='0' offset='0/1000s' ref='k2' duration='5000/1000s' audioRole='Music'> | ||
<marker start='7/30s' duration='1/48000s' value='beat_at_0.25' completed='0'/> | ||
<marker start='23/30s' duration='1/48000s' value='beat_at_0.77' completed='0'/> | ||
<marker start='38/30s' duration='1/48000s' value='beat_at_1.28' completed='0'/> | ||
<marker start='54/30s' duration='1/48000s' value='beat_at_1.8' completed='0'/> | ||
<marker start='69/30s' duration='1/48000s' value='beat_at_2.32' completed='0'/> | ||
<marker start='85/30s' duration='1/48000s' value='beat_at_2.84' completed='0'/> | ||
<marker start='100/30s' duration='1/48000s' value='beat_at_3.35' completed='0'/> | ||
<marker start='116/30s' duration='1/48000s' value='beat_at_3.87' completed='0'/> | ||
<marker start='131/30s' duration='1/48000s' value='beat_at_4.39' completed='0'/> | ||
<marker start='147/30s' duration='1/48000s' value='beat_at_4.91' completed='0'/> | ||
<marker start='162/30s' duration='1/48000s' value='beat_at_5.42' completed='0'/> | ||
<audio-channel-source role='music.music-1' srcCh='1, 2'/> | ||
</asset-clip> | ||
</spine> | ||
</sequence> | ||
</project> | ||
</event> | ||
</library> | ||
</fcpxml> |
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