#coding=utf-8 namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do i = [] Video.where.not(uuid: nil, file_url: nil).where(transcoded: false, status: "published").find_each do |v| code_info = AliyunVod::Service.get_meta_code_info(v.uuid) if v.file_url.include?('.mp4') && code_info[:codecnamne]&.include?("h264") v.update(transcoded: true) else puts("uuid: #{v.uuid}") i << "#{v.id}, #{v.file_url}, #{code_info[:codecnamne]}" AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') end end puts "###########转码个数:#{i.size}" puts "###########id,file_url, codecnamne:#{i}" end end