From 7a8e9226438998af3af5305fc7d94f448ffaa851 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 22:44:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/video_transcode.rake | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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