diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index 995f9a82f..ecb5afdc6 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -2,13 +2,18 @@ namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do - Video.find_each do |v| - if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid)[:codecnamne].start_with?("h264", "h265") - p "--- Start submit video trans code #{v.uuid}" + i = 1 + Video.where.not(uuid: nil, file_url: nil).where(transcoded: false).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") + puts "v.file_url: #{v.file_url}, code_info[:codecnamne]: #{code_info[:codecnamne]}" + i += 1 AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') else v.update(transcoded: true) end end + puts "###########转码个数:#{i}" + end end \ No newline at end of file