@ -30,8 +30,10 @@ class Videos::BatchPublishService < ApplicationService
end
# 标清转码为h264
if AliyunVod::Service.get_meta_code_info(video.uuid).start_with?('h264', 'h265', 'flv')
if AliyunVod::Service.get_meta_code_info(video.uuid).start_with?('h264', 'h265')
video.transcoded = true
result = AliyunVod::Service.get_play_info(video.uuid)
video.play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL']
else
AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID)
@ -15,7 +15,6 @@ class Videos::DispatchCallbackService < ApplicationService
video.file_url = convert_https(params['FileUrl'])
video.filesize = params['Size']
video.upload_success
video.play_url = video.file_url if video.transcoded #不需要转码时,则统一播放地址
video.save!
when 'SnapshotComplete' then # 封面截图完成
return if video.cover_url.present?
@ -1,4 +1,4 @@
json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv, :user_id
json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv, :user_id, :transcoded
json.play_duration video.video_play_duration
json.published_at video.display_published_at
@ -3,7 +3,7 @@ namespace :video_transcode do
desc "视频转码成h264"
task :submit => :environment do
Video.find_each do |v|
if v.uuid && v.transcoded == false && AliyunVod::Service.get_meta_code_info(v.uuid).start_with?("h264", "h265", "flv") == false
if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid).start_with?("h264", "h265")
p "--- Start submit video trans code #{v.uuid}"
AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e')