summaryrefslogtreecommitdiff
path: root/hacks
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-05-15 23:48:59 +0100
committerCarl Hetherington <cth@carlh.net>2019-05-15 23:48:59 +0100
commitd2ce97f930b53ec7d50c22a11dd03b7264b25039 (patch)
tree5f154feeab38a288635e90b6510b8c58d706aeaf /hacks
parent7ceb67dae630ddefc10090be5a0a8dea9ac835ad (diff)
Add dummy file creation for FFmpeg audio-only.
Diffstat (limited to 'hacks')
-rwxr-xr-xhacks/make_dummy_files8
1 files changed, 8 insertions, 0 deletions
diff --git a/hacks/make_dummy_files b/hacks/make_dummy_files
index 009ae864a..572f40e64 100755
--- a/hacks/make_dummy_files
+++ b/hacks/make_dummy_files
@@ -83,6 +83,14 @@ for c in tree.getroot().find('Playlist').findall('Content'):
video_length = int(c.find('VideoLength').text)
path = os.path.join(sys.argv[1], 'dummy', ntpath.basename(c.find('Path').text))
os.system('ffmpeg -t %d -s qcif -f rawvideo -pix_fmt rgb24 -r %d -i /dev/zero -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000 -shortest "%s"' % (float(video_length) / video_frame_rate, video_frame_rate, path))
+ elif c.find('AudioGain') is not None:
+ audio_frame_rate = int(c.find('AudioStream').find('FrameRate').text)
+ channels = int(c.find('AudioStream').find('Mapping').find('InputChannels').text)
+ path = os.path.join(sys.argv[1], 'dummy', ntpath.basename(c.find('Path').text))
+ audio_length = int(c.find('AudioStream').find('Length').text)
+ os.system('sox -n -r %d -c %d %s trim 0.0 %f' % (audio_frame_rate, channels, path, float(audio_length) / audio_frame_rate))
+ else:
+ print 'Skipped %s' % type
elif type == 'Image':
width = int(c.find('VideoWidth').text)
height = int(c.find('VideoHeight').text)