summaryrefslogtreecommitdiff
path: root/video-metadata.rb
diff options
context:
space:
mode:
Diffstat (limited to 'video-metadata.rb')
-rwxr-xr-xvideo-metadata.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/video-metadata.rb b/video-metadata.rb
new file mode 100755
index 0000000..654ce0c
--- /dev/null
+++ b/video-metadata.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+require 'json'
+
+Dir[File.join(ARGV[0], "videos", "*", "*.mp4")].each do |video|
+ # tmp = File.join("/tmp", File.basename(video))
+ tmp = video + "~"
+ print `cp #{video} #{tmp}`
+ meta = {
+ "title" => File.basename(video, ".mp4").gsub("_", " "),
+ "date" => video.split("/")[-2].split("_")[0],
+ "artist" => "pdp8@pdp8.info",
+ "copyright" => "© pdp8@pdp8.info Creative Commons Attribution-ShareAlike 4.0 International License",
+ }
+ cmd = "ffmpeg -i #{tmp} -c copy "
+ meta.each do |k, v|
+ cmd += "-metadata #{k}=\"#{v}\" "
+ end
+ cmd += " #{video}"
+ puts cmd
+ print `#{cmd}`
+end