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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9ce2805dfffb2f6e4abfa0f3ef4bd2fa66291856fc4e1f96e3973e8b2c11959
4
- data.tar.gz: 19d2152c8c932610344d74eccf9e91dfdd823faf405e94c80fe5269935a0da23
3
+ metadata.gz: 58115d1a5b88045b7d20440afe38eee54a8ede27d5152819a6f74ec76ff342ef
4
+ data.tar.gz: 3103f445d9b117f4c22ef1ef6eaa656b886072f57bd146d33ade6be4af1d1a7d
5
5
  SHA512:
6
- metadata.gz: 877502e110a4231c450eb43abf17a0a3074448afad867d747b045201e02dcc108dc722ef3aff297ec1ab862a8841f4d23310c280289b4d7797274026559b6b8f
7
- data.tar.gz: d2c0e2f2e45bedabe855356c97106cc16f3bb231625d98d6ecce6872ca0bbf03dd0ea6e23a6d9a619f9295e841f2a12382d46e13aab1d6d62a1ae48cddce3f97
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
- # 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'
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
- # 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'
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
- # 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'
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
- # 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'
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
- # 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'
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
- # 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'
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
- # 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
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
- # 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'
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], disabled: true
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.226
4
+ version: 3.1.0.228
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev