wco_models 3.1.0.226 → 3.1.0.228
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/wco/newsvideos_controller.rb +80 -80
- data/app/views/wco/newsoverlays/_form.haml +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 58115d1a5b88045b7d20440afe38eee54a8ede27d5152819a6f74ec76ff342ef
|
|
4
|
+
data.tar.gz: 3103f445d9b117f4c22ef1ef6eaa656b886072f57bd146d33ade6be4af1d1a7d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37c8df59d52d572b8beea6d10e1de0c0ff96b8cfc02631bbe43de63eef059f5939187e6044755900b4ae15b3b90c0076d014d0f28e08c9ee1e734edfd321f6d6
|
|
7
|
+
data.tar.gz: 3aeee10c75c94694899c3faa57bc42287f80cef5faec3e6277dcc09942db923b7b43e6e7a69f99afa6fc4825733b221def4f5d1a5266126e3e977b0ca168aedb
|
|
@@ -34,100 +34,100 @@ class Wco::NewsvideosController < Wco::ApplicationController
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
## put together config
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
cmd = "cd #{Rails.root.join('tmp')} ; mkdir -p #{@newsvideo.id} ; cd #{@newsvideo.id} ; rm -f videolist.txt audiolist.txt ; "
|
|
38
|
+
@newsvideo.newspartials.each_with_index do |part, idx|
|
|
39
|
+
cmd = "#{cmd} echo \"file 'newspartial_#{idx}.mp4' \" >> videolist.txt ; "
|
|
40
|
+
cmd = "#{cmd} echo \"file 'newspartial_#{idx}.wav' \" >> audiolist.txt ; "
|
|
41
|
+
cmd = "#{cmd} ffmpeg -i newspartial_#{idx}.webm newspartial_#{idx}.mp4 ; "
|
|
42
|
+
end
|
|
43
|
+
puts! cmd, 'cmd'
|
|
44
|
+
out = `#{cmd}`
|
|
45
|
+
puts! out, 'out'
|
|
46
46
|
|
|
47
47
|
## get base files locally
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
cmd = "cd #{Rails.root.join('tmp', @newsvideo.id)} ; "
|
|
49
|
+
@newsvideo.newspartials.each_with_index do |part, idx|
|
|
50
|
+
cmd = "#{cmd} wget -O newspartial_#{idx}.webm #{part.video.video.url} ; "
|
|
51
|
+
cmd = "#{cmd} wget -O newspartial_#{idx}.wav #{part.audio.url} ; "
|
|
52
|
+
end
|
|
53
|
+
puts! cmd, 'cmd'
|
|
54
|
+
out = `#{cmd}`
|
|
55
|
+
puts! out, 'out'
|
|
56
56
|
|
|
57
57
|
## get overlays
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
cmd = "cd #{Rails.root.join('tmp', @newsvideo.id)} ; "
|
|
59
|
+
@newsvideo.newsoverlays.each_with_index do |overlay, idx|
|
|
60
|
+
cmd = "#{cmd} wget -O overlay_#{idx}.mp4 #{overlay.video.video.url} ; "
|
|
61
|
+
end
|
|
62
|
+
puts! cmd, 'cmd'
|
|
63
|
+
out = `#{cmd}`
|
|
64
|
+
puts! out, 'out'
|
|
65
65
|
|
|
66
66
|
## video concat
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
cmd = <<AOL
|
|
68
|
+
cd #{Rails.root.join('tmp', @newsvideo.id)} ;
|
|
69
|
+
rm -f video_concat.mp4 ;
|
|
70
|
+
ffmpeg -f concat -safe 0 -i videolist.txt -c copy video_concat.mp4 ;
|
|
71
|
+
AOL
|
|
72
|
+
puts! cmd, 'cmd'
|
|
73
|
+
out = `#{cmd}`
|
|
74
|
+
puts! out, 'out'
|
|
75
75
|
|
|
76
76
|
## audio concat
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
audio_filenames = (0...@newsvideo.newspartials.length).map { |i| "newspartial_#{i}.wav" }.join("|")
|
|
78
|
+
cmd = <<AOL
|
|
79
|
+
cd #{Rails.root.join('tmp', @newsvideo.id)} ;
|
|
80
|
+
rm -f audio_concat.wav ;
|
|
81
|
+
ffmpeg -f concat -safe 0 -i audiolist.txt -c copy audio_concat.wav ;
|
|
82
|
+
AOL
|
|
83
|
+
puts! cmd, 'cmd'
|
|
84
|
+
out = `#{cmd}`
|
|
85
|
+
puts! out, 'out'
|
|
86
86
|
|
|
87
87
|
## combine base
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
cmd = <<AOL
|
|
89
|
+
cd #{Rails.root.join('tmp', @newsvideo.id)} ;
|
|
90
|
+
rm -f output.mp4 ;
|
|
91
|
+
ffmpeg -i video_concat.mp4 -i audio_concat.wav -c:v copy -c:a aac combined_base.mp4 ;
|
|
92
|
+
AOL
|
|
93
|
+
puts! cmd, 'cmd'
|
|
94
|
+
out = `#{cmd}`
|
|
95
|
+
puts! out, 'out'
|
|
96
96
|
|
|
97
97
|
## combine overlays
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
#
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
#
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
98
|
+
nn = @newsvideo.newsoverlays.map { |ol| ol.start_at_ms }
|
|
99
|
+
puts! nn, 'nn'
|
|
100
|
+
ffmpeg_cmd = [ "ffmpeg -i combined_base.mp4 \\ " ]
|
|
101
|
+
nn.each_with_index do |ms, idx|
|
|
102
|
+
ffmpeg_cmd.push " -i overlay_#{idx}.mp4 \\ "
|
|
103
|
+
end
|
|
104
|
+
ffmpeg_cmd.push "-filter_complex \" \\ "
|
|
105
|
+
#
|
|
106
|
+
nn.each_with_index do |ms, idx|
|
|
107
|
+
ffmpeg_cmd.push " [#{idx+1}:v]setpts=PTS-STARTPTS+#{ms.to_f/1000}/TB[v#{idx+1}]; \\ "
|
|
108
|
+
end
|
|
109
|
+
#
|
|
110
|
+
curr_s = "0:v"
|
|
111
|
+
n = nil
|
|
112
|
+
nn.each_with_index do |ms, idx|
|
|
113
|
+
n = idx+1
|
|
114
|
+
ffmpeg_cmd.push " [#{curr_s}][v#{n}]overlay=0:0:eof_action=pass[tmp#{n}]; \\ "
|
|
115
|
+
curr_s = "tmp#{n}"
|
|
116
|
+
end
|
|
117
|
+
ffmpeg_cmd.push " \" -map \"[#{curr_s}]\" -map 0:a? -c:v libx264 -c:a copy combined_fin.mp4 "
|
|
118
|
+
ffmpeg_cmd = ffmpeg_cmd.join("\n")
|
|
119
|
+
puts "+++ ffmpeg_cmd:"
|
|
120
|
+
puts ffmpeg_cmd
|
|
121
121
|
|
|
122
122
|
# combine overlays 2
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
#
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
123
|
+
cmd = <<AOL
|
|
124
|
+
cd #{Rails.root.join('tmp', @newsvideo.id)} ;
|
|
125
|
+
rm -f combined_fin.mp4 ;
|
|
126
|
+
#{ffmpeg_cmd} ;
|
|
127
|
+
AOL
|
|
128
|
+
puts! cmd, 'cmd'
|
|
129
|
+
out = `#{cmd}`
|
|
130
|
+
puts! out, 'out'
|
|
131
131
|
|
|
132
132
|
## upload the video.
|
|
133
133
|
@video = Wco::Video.new name: @newsvideo.title
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
.field.d-flex.flex-column
|
|
11
11
|
%label Video
|
|
12
|
-
= f.text_field :video_id, value: newsoverlay[:video_id] || params[:video_id]
|
|
12
|
+
= f.text_field :video_id, value: newsoverlay[:video_id] || params[:video_id]
|
|
13
13
|
.flex-row
|
|
14
14
|
.thumb= image_tag( newsoverlay.video.thumb.url( :thumb ), :alt => '' )
|
|
15
15
|
.a Duration: #{newsoverlay.video.duration_ms}ms
|