转码问题

dev_jupyter
daiao 5 years ago
parent 4a090926dd
commit 7a8e922643

@ -2,13 +2,18 @@
namespace :video_transcode do namespace :video_transcode do
desc "视频转码成h264" desc "视频转码成h264"
task :submit => :environment do task :submit => :environment do
Video.find_each do |v| i = 1
if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid)[:codecnamne].start_with?("h264", "h265") Video.where.not(uuid: nil, file_url: nil).where(transcoded: false).find_each do |v|
p "--- Start submit video trans code #{v.uuid}" code_info = AliyunVod::Service.get_meta_code_info(v.uuid)
if !v.file_url.include?('.mp4') && !code_info[:codecnamne]&.include?("h264")
puts "v.file_url: #{v.file_url}, code_info[:codecnamne]: #{code_info[:codecnamne]}"
i += 1
AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e')
else else
v.update(transcoded: true) v.update(transcoded: true)
end end
end end
puts "###########转码个数:#{i}"
end end
end end
Loading…
Cancel
Save