Short video matrix management system source code development: video batch editing, distribution function development example

The development of the short video matrix management system first requires the server:

Server configuration required for source code 1. Specifications: minimum 8-core 16G

2. Hard disk: system disk 40-100G, data disk no less than 100G

3. Bandwidth: 10M

4. System: CentOS7 (must choose 7.*)

During the deployment process, in addition to the requirements for the server, it is also necessary to provide the domain name for filing. The filing of the domain name generally takes 7-15 working days. Due to different regions, the time period for filing and review is also different.

Video batch editing function development:

In the process of video batch editing, different editing modes are adopted: for example, intelligent mixed cutting, intelligent random, scene sequence, picture combination, etc., and will develop more and different functions according to market development in the future

Development Showcase: 

 <van-tab title="自定义文案" title-style="font-size:32rpx;font-weight:700">
                <!-- 内容2 -->
                <view class="content">
                    <!-- 顶部 -->
                    <view class="top">
                        <view>
                            不会撰写爆款文案?
                        </view>
                       <view style="display: flex;align-items: center;">
                        <navigator url="/subpages/chatIndex/chatIndex" class="jddg" style="margin-right: 16rpx;">
                            AI智能文案
                        </navigator>
                        <view class="jddg" bindtap="toDraftWrite">
                            行业文案库
                        </view>
                       </view>
                    </view>
                    <!-- 顶部添加 -->
                    <view class="addCopy" bindtap="addCopy">
                        <image src="../../static/select/title/add.png" class="addImg"></image>添加自定义文案
                    </view>
                    <!-- 添加的文案内容 -->
                    <!-- 每一个 -->
                    <view  wx:for="{
   
   {editList}}" wx:key="index" class="listEvery e">
                        <view class="title">
                            第{
   
   {index+1}}个文案
                        </view>
                        <!-- 内容 -->
                        <view class="copywriter w">
                            <view class="wTxt">{
   
   {item.copy}}</view>
                            <view bindtap="delCopy" data-index="{
   
   {index}}" class="wImg"><image class="delImg" src="../../static/select/title/del.png"></image></view>
                            <van-dialog id="van-dialog" confirm-button-color="#586893" customStyle="border-radius:20rpx" confirmButtonText="确定"  />
                        </view>
                    </view>
                </view>

Video distribution: in the form of publishing videos on behalf of users

The main purpose of this capability is to allow users to publish publicly available content from the developer’s application to the user’s own Douyin account works with user authorization, and set relevant titles, topics, anchors and other information.

scope of application

The current capability only supports website applications to apply for activation.

scenes to be used

It can only be authorized and used in the computer-side website of the website application, and the scope of available scenarios :

  1. [Government media] It can support government affairs or media organizations as an internal multimedia management platform, but it cannot be used externally for C-end users; (if it is an agent development model, the agency company needs to provide a letter of authorization)
  2. [Enterprise Services] It can support enterprise service platforms and serve as an internal content management service platform for Douyin accounts. It can only perform toB scenarios for enterprises and enterprise employees to use for their own accounts; background capabilities, authorization codes, and related functions cannot be exposed to ordinary users online or offline;

The list of interfaces used is

The code is displayed as follows:


    /*
     * 新增场景
     */
    public function addSceneAction() {
        $dv_id  = $this->request->getIntParam('dv_id');
        $name   = $this->request->getStrParam('name');
        $scene_model    = new App_Model_Douyin_MysqlVideoSceneStorage();
        $video_model    = new App_Model_Douyin_MysqlVideoStorage();
        $video_item     = $video_model->getRowByIdSid($dv_id, $this->sid);
        if (empty($video_item)) {
            $this->displayJsonError('参数错误');
        }

        $max_scene  = $scene_model->getMaxSceneByDvid($dv_id);
        $indata = [
            'dvs_dv_id' => $dv_id,
            'dvs_ds_id' => $this->sid,
            'dvs_name'  => $name,
            'dvs_duration'  => $video_item['dv_video_shot']*1000,
            'dvs_scene' => $max_scene+1,
            'dvs_create_time'   => time(),
        ];
        $ret    = $scene_model->insertValue($indata);
        if ($ret) {
            $video_model->incNumberById('dv_video_use', 1, $dv_id);
        }
        $url    = "/dydqtshoppc/video/startProject?dv_id={$dv_id}&type=1&scene=".$indata['dvs_scene'];
        $this->displayJsonSuccess(['url' => $url], true, '添加成功');
    }

    public function deleteSceneAction() {
        $dv_id  = $this->request->getIntParam('dv_id');
        $scene  = $this->request->getIntParam('scene', 1);
        if ($scene == 1) {
            $this->displayJsonError('第一个场景不允许删除');
        }
        $scene_model    = new App_Model_Douyin_MysqlVideoSceneStorage();
        $video_model    = new App_Model_Douyin_MysqlVideoStorage();

        $where  = [
            ['name' => 'dvs_ds_id', 'oper' => '=', 'value' => $this->sid],
            ['name' => 'dvs_dv_id', 'oper' => '=', 'value' => $dv_id],
            ['name' => 'dvs_scene', 'oper' => '=', 'value' => $scene]
        ];
        $ret    = $scene_model->deleteValue($where);
        if ($ret) {
            $video_model->decNumberById('dv_video_use', 1, $dv_id);
        }
        $url    = "/dydqtshoppc/video/startProject?dv_id={$dv_id}&type=1&scene=1";
        $this->displayJsonSuccess(['url' => $url], true, '删除成功');
    }
    /*
     * 视频缓存
     */
    public function cacheVideoAction() {
        //面包屑
        $breadcrumbs = [
            ['title' => 'AI视频创意', 'link' => '#'],
            ['title' => '视频仓库', 'link' => ''],
        ];
        $this->buildBreadcrumbs($breadcrumbs);

        $dv_id  = $this->request->getStrParam('dv_id');
        $video_model    = new App_Model_Douyin_MysqlVideoStorage();
        $video_info     = $video_model->getRowByIdSid($dv_id, $this->sid);
        if (empty($video_info)) {
            $this->displayBlankPage('参数错误');
        }
        $this->output['video_info']     = $video_info;
        //获取视频缓存列表
        $where = [
            ['name' => 'dvtv_s_id', 'oper' => '=', 'value' => $this->sid],
            ['name' => 'dvtv_dv_id', 'oper' => '=', 'value' => $dv_id],
        ];
        $cache_model    = new App_Model_Douyin_MysqlVideoTempVideoStorage();
        $template_list  = $cache_model->getList($where,$this->index,$this->count);

        foreach ($template_list as &$item) {
            $item['score']  = 100 - min($item['dvtv_score'], 100);
            $use_platform   = empty($item['dvtv_use_platform']) ? [] : json_decode($item['dvtv_use_platform'], 1);
            $use_platform   = array_unique($use_platform);
            $item['used_count'] = count($use_platform);
            $item['used_platform']  = $use_platform;
        }

        //计算分页
        $template_list_all = $cache_model->getCount($where);
        $page_libs = new Libs_Pagination_Paginator($template_list_all,$this->count,'jquery',true);
        $pageHtml = $page_libs->render();

        $this->output['template_list']  = $template_list;
        $this->output['pageHtml']       = $pageHtml;
        $this->output['dv_id']          = $dv_id;
        $this->output_materail_link($dv_id, 0, $video_info);
        //点数展示
        $collect_model  = new App_Model_Douyin_MysqlCollectShopStorage();
        $collect_info   = $collect_model->getCollectSurplusBySid($this->sid);
        $this->output['collect_info']   = $collect_info;
        //预约列表
        $appoint_model  = new App_Model_Task_MysqlAppointTaskStorage();
        $appoint_where  = [
            ['name' => 'va_ds_id', 'oper' => '=', 'value' => $this->sid],
            ['name' => 'va_dv_id', 'oper' => '=', 'value' => $dv_id],
            #['name' => 'va_status', 'oper' => '<>', 'value' => 2],
        ];
        $appoint_sort   = ['va_status' => 'ASC'];
        $appoint_list   = $appoint_model->getList($appoint_where, 0, 1, $appoint_sort);
        $this->output['appoint_list']   = $appoint_list;
        $this->output['platform_list']  = $this->platform;
        $this->output['appoint_status'] = [
            0   => '<span style="color: #ff875c;">待执行</span>',
            1   => '<span style="color: darkgreen">执行中</span>',
            2   => '<span style="color: red">已结束</span>',
            3   => '<span style="color: #db4040;">异常中断</span>',
        ];

        $this->displaySmarty('dydqtshoppc/video/edit-project.tpl');
    }
    /*
     * 生成预览视频
     */
    public function previewVideoAction() {
        $dv_id  = $this->request->getIntParam('dv_id');
        $temp_id    = $this->request->getIntParam('temp_id', 0);
        $cache_model    = new App_Model_Douyin_MysqlVideoTempVideoStorage();
        $cache_video    = $cache_model->getPreviewVideo($dv_id);

        //判断点数
        $collect_model  = new App_Model_Douyin_MysqlCollectShopStorage();
        $collect_info   = $collect_model->getCollectSurplusBySid($this->sid);

        if (!$collect_info['cs_surplus']) {
            $this->displayJsonError('无可用点数,无法合成预览视频');
        }

        if (empty($temp_id)) {
            if ($cache_video) {
                $this->displayJsonSuccess(['path' => $cache_video['dvtv_video_path']], true, '合成成功');
            } else {
                $this->createTempVideoAction($dv_id, 1);
                $this->displayJsonSuccess(null, true, '预览视频正在努力合成中……');
            }
        } else {
            $cache_id   = empty($cache_video) ? 0 : $cache_video['dvtv_id'];
            if ($temp_id == $cache_id) {
                $this->displayJsonSuccess(null, true, '预览视频正在努力合成中……');
            } else {
                $this->displayJsonSuccess(['path' => $cache_video['dvtv_video_path']], true, '合成成功');
            }
        }
    }

 

Guess you like

Origin blog.csdn.net/m0_71850852/article/details/130385402