jquery tween.js优化版 写过渡动画

jquery tween.js优化版 写过渡动画

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <title>
        Document
    </title>
    <style type="text/css">
    #div {
        width: 100px;
        height: 100px;
        background: red;
    }
    </style>
    <script type="text/javascript">
    var Tween = {
        linear: function(t, b, c, d) {
            return c * t / d + b;
        },
        easeIn: function(t, b, c, d) {
            return c * (t /= d) * t + b;
        },
        easeOut: function(t, b, c, d) {
            return -c * (t /= d) * (t - 2) + b;
        },
        easeBoth: function(t, b, c, d) {
            if ((t /= d / 2) < 1) {
                return c / 2 * t * t + b;
            }
            return -c / 2 * ((--t) * (t - 2) - 1) + b;
        },
        easeInStrong: function(t, b, c, d) {
            return c * (t /= d) * t * t * t + b;
        },
        easeOutStrong: function(t, b, c, d) {
            return -c * ((t = t / d - 1) * t * t * t - 1) + b;
        },
        easeBothStrong: function(t, b, c, d) {
            if ((t /= d / 2) < 1) {
                return c / 2 * t * t * t * t + b;
            }
            return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
        },
        elasticIn: function(t, b, c, d, a, p) {
            if (t === 0) {
                return b;
            }
            if ((t /= d) == 1) {
                return b + c;
            }
            if (!p) {
                p = d * 0.3;
            }
            if (!a || a < Math.abs(c)) {
                a = c;
                var s = p / 4;
            } else {
                var s = p / (2 * Math.PI) * Math.asin(c / a);
            }
            return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
        },
        elasticOut: function(t, b, c, d, a, p) {
            if (t === 0) {
                return b;
            }
            if ((t /= d) == 1) {
                return b + c;
            }
            if (!p) {
                p = d * 0.3;
            }
            if (!a || a < Math.abs(c)) {
                a = c;
                var s = p / 4;
            } else {
                var s = p / (2 * Math.PI) * Math.asin(c / a);
            }
            return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
        },
        elasticBoth: function(t, b, c, d, a, p) {
            if (t === 0) {
                return b;
            }
            if ((t /= d / 2) == 2) {
                return b + c;
            }
            if (!p) {
                p = d * (0.3 * 1.5);
            }
            if (!a || a < Math.abs(c)) {
                a = c;
                var s = p / 4;
            } else {
                var s = p / (2 * Math.PI) * Math.asin(c / a);
            }
            if (t < 1) {
                return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) *
                    Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
            }
            return a * Math.pow(2, -10 * (t -= 1)) *
                Math.sin((t * d - s) * (2 * Math.PI) / p) * 0.5 + c + b;
        },
        backIn: function(t, b, c, d, s) {
            if (typeof s == 'undefined') {
                s = 1.70158;
            }
            return c * (t /= d) * t * ((s + 1) * t - s) + b;
        },
        backOut: function(t, b, c, d, s) {
            if (typeof s == 'undefined') {
                s = 2.70158; //回缩的距离  
            }
            return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
        },
        backBoth: function(t, b, c, d, s) {
            if (typeof s == 'undefined') {
                s = 1.70158;
            }
            if ((t /= d / 2) < 1) {
                return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
            }
            return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
        },
        bounceIn: function(t, b, c, d) {
            return c - Tween['bounceOut'](d - t, 0, c, d) + b;
        },
        bounceOut: function(t, b, c, d) {
            if ((t /= d) < (1 / 2.75)) {
                return c * (7.5625 * t * t) + b;
            } else if (t < (2 / 2.75)) {
                return c * (7.5625 * (t -= (1.5 / 2.75)) * t + 0.75) + b;
            } else if (t < (2.5 / 2.75)) {
                return c * (7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375) + b;
            }
            return c * (7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375) + b;
        },
        bounceBoth: function(t, b, c, d) {
            if (t < d / 2) {
                return Tween['bounceIn'](t * 2, 0, c, d) * 0.5 + b;
            }
            return Tween['bounceOut'](t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b;
        }
    };

    function cssTransform(el, attr, val) {
        if (!el.transform) {
            el.transform = {}
        }
        if (typeof val == "undefined") {
            if (typeof el.transform[attr] == "undefined") {
                switch (attr) {
                    case "scale":
                    case "scaleX":
                    case "scaleY":
                        el.transform[attr] = 100;
                        break;
                    default:
                        el.transform[attr] = 0;
                }
            }
            return el.transform[attr];
        } else {
            var transformVal = "";
            el.transform[attr] = Number(val);
            for (var s in el.transform) {
                switch (s) {
                    case "rotate":
                    case "rotateX":
                    case "rotateY":
                    case "rotateZ":
                    case "skewX":
                    case "skewY":
                        transformVal += " " + s + "(" + el.transform[s] + "deg)";
                        break;
                    case "translateX":
                    case "translateY":
                    case "translateZ":
                        transformVal += " " + s + "(" + el.transform[s] + "px)";
                        break;
                    case "scale":
                    case "scaleX":
                    case "scaleY":
                        transformVal += " " + s + "(" + el.transform[s] / 100 + ")";
                        break;
                }
            }
            el.style.WebkitTransform = el.style.transform = transformVal;
        }
    }

    function css(element, attr, val) {
        if (attr == "rotate" || attr == "rotateX" ||
            attr == "rotateY" || attr == "rotateZ" ||
            attr == "scale" || attr == "scaleX" ||
            attr == "scaleY" || attr == "skewX" ||
            attr == "skewY" || attr == "translateX" ||
            attr == "translateY" || attr == "translateZ") {
            return cssTransform(element, attr, val);
        }
        if (arguments.length == 2) { //只要两个参数的时候是获取属性  
            var val = getComputedStyle(element)[attr];
            if (attr == 'opacity') {
                val = Math.round(val * 100); //透明的*100 减少小数误差  
            }
            return parseFloat(val);
        }
        if (attr == "opacity") {
            element.style.opacity = val / 100;
        } else {
            element.style[attr] = val + "px";
        }
    }

    function MTween(init) { //对tween进行再次封装  
        var t = 0; //当前计时  
        var b = {}; //当前值  
        var c = {}; //目标值和当前值得差  
        var d = init.time / 20; //终止时间  
        for (var s in init.target) {
            b[s] = css(init.el, s);
            c[s] = init.target[s] - b[s];
        }
        clearInterval(init.el.timer);
        init.el.timer = setInterval(
            function() {
                t++;
                if (t > d) {
                    clearInterval(init.el.timer);
                    init.callBack && init.callBack.call(init.el);
                } else {
                    init.callIn && init.callIn.call(init.el);
                    for (var s in b) {
                        var val = (Tween[init.type](t, b[s], c[s], d)).toFixed(2);
                        css(init.el, s, val);
                    }
                }
            },
            20
        );
    }
    </script>
    <script type="text/javascript">
    window.onload = function() {
        var div = document.querySelector('#div');

        MTween({
            el: div,
            target: {
                width: 400,
                height: 300,
                opacity: 50,
                rotate: 50,
            },
            time: 1000,
            type: "linear",
            callBack: function() {
                console.log("动画执行完了");
             /*   MTween({
                    el: div,
                    target: {
                        width: 200,
                        height: 100,
                        opacity: 20,
                        rotate: 10,
                    },
                    time: 1000,
                    type: "linear",
                    callBack: function() {
                        console.log("动画执行完了");
                    },
                    callIn: function() {
                        console.log("动画执行中");
                    }
                });*/
            },
            callIn: function() {
                console.log("动画执行中");
            }
        });

        /*  
            必写参数:  
                el 元素   
                target {} 目标点  
                time: 动画持续时间 (ms)     
                type: 动画类型 "string"  
            可选参数:  
                callBack: fn 回调函数(动画执行完之后,执行的函数)  
                callIn: fn  并发函数 (动画执行完中,执行的函数)  
        */
    };
    </script>
</head>

<body>
    <div id="div">
    </div>
</body>

</html>

如果过渡动画不能满足 那就用原版
http://down.htmleaf.com/1501/201501271734.zip
其实原版就是数值属性的变化 然后再update定时器中更新

php 开启微信公众号开发者模式

php 开启微信公众号开发者模式

<?php
/**
  * wechat php test
  */
header('Content-type:text');
//define your token
//定义TOKEN密钥
define("TOKEN", "weixin");
//实例化微信对象
$wechatObj = new wechatCallbackapiTest();
//验证成功后注释掉valid方法
$wechatObj->valid();
//开启自动回复功能
$wechatObj->responseMsg();
//定义类文件
class wechatCallbackapiTest
{
    //实现valid验证方法:实现对接微信公众平台
    public function valid()
    {
        //通过GET请求接收随机字符串
        $echoStr = $_GET["echostr"];
        //调用checkSignature方法进行用户(开发者)数字签名验证
        //valid signature , option
        if($this->checkSignature()){
            //如果成功,则返回接收到的随机字符串
            echo $echoStr;
            //并退出
            exit;
        }
    }

    public function responseMsg()
    {
        //get post data, May be due to the different environments
        //接收用户端(客户)发送过来的XML数据
        $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];

          //extract post data
        //判断XML数据是否为空
        if (!empty($postStr)){
                /* libxml_disable_entity_loader is to prevent XML eXternal Entity Injection,
                   the best way is to check the validity of xml by yourself */
                libxml_disable_entity_loader(true);
                //通过simplexml进行xml解析     PHP中有两大类可以完成对XML的解析,1.PHP的Dom模型2.通过simplexml模型
                  $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
                //手机端
                $fromUsername = $postObj->FromUserName;
                //微信公众平台
                $toUsername = $postObj->ToUserName;
                //接收用户发送的关键词
                $keyword = trim($postObj->Content);
                //时间戳
                $time = time();
                //文本发送模板
                $textTpl = "<xml>
                            <ToUserName><![CDATA[%s]]></ToUserName>
                            <FromUserName><![CDATA[%s]]></FromUserName>
                            <CreateTime>%s</CreateTime>
                            <MsgType><![CDATA[%s]]></MsgType>
                            <Content><![CDATA[%s]]></Content>
                            <FuncFlag>0</FuncFlag>
                            </xml>";   
                //判断用户发送关键词是否为空
                if(!empty( $keyword ))
                {
                    //回复类型,如果为"text",代表文本类型
                      $msgType = "text";
                    //回复内容
                    $contentStr = "Welcome to wechat world!";
                    //格式化字符串(对xml进行格式化操作,把里面相关的变量格式化成字符串)
                    $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                    //把XML数据返回给手机端
                    echo $resultStr;
                }
                //如果用户发送的关键词为空,则返回下列字符串
                else{
                    echo "Input something...";
                }

        }else {
            echo "";
            exit;
        }
    }
    
    //定义checkSignature方法
    private function checkSignature()
    {
        // you must define TOKEN by yourself
        
        //判断TOKEN密钥是否定义
        if (!defined("TOKEN")) {
            //如果没有定义则抛出异常,返回'TOKEN is not defined!'字符串
            throw new Exception('TOKEN is not defined!');
        }
        //接收微信加密签名
        $signature = $_GET["signature"];
        //接收时间戳信息
        $timestamp = $_GET["timestamp"];
        //接收随机数
        $nonce = $_GET["nonce"];
        //把TOKEN常量赋值给$token变量    
        $token = TOKEN;
        //把相关参数组装为数组(密钥文件、时间戳、随机数)
        $tmpArr = array($token, $timestamp, $nonce);
        // use SORT_STRING rule
        //通过字典法进行排序
        sort($tmpArr, SORT_STRING);
        //把排序后的数组转化为字符串
        $tmpStr = implode( $tmpArr );
        //通过哈希算法对字符串进行加密操作
        $tmpStr = sha1( $tmpStr );
        //与加密签名进行对比
        if( $tmpStr == $signature ){
            return true;
        }else{
            return false;
        }
    }
}

?>

1 TOKEN要跟微信公众号后台的TOKEN对应就行
2 $wechatObj->valid(); 微信公众号后台验证完就可以注释掉

php+mysql 实现无限极分类

php+mysql 实现无限极分类

id        name        pid        path

1         电脑         0           0

2         手机         0           0

3         笔记本     1           0-1

4         超级本     3           0-1-3

5         游戏本     3           0-1-3

这种方式,假设我们要查询电脑下的所有后代分类,只需要一条sql语句:

select id,name from category where path like ( select concat(path,'-',id,'%') path from category where id=1 );

优点:查询容易,效率高,path字段可以加索引。

缺点:更新节点关系麻烦,需要更新所有后辈的path字段。

方案一的样例代码:

<?php

$addrs = array(

    array('id'=>1, 'name'=>'中国', 'pid'=>0),

    array('id'=>2, 'name'=>'河南', 'pid'=>1),

    array('id'=>3, 'name'=>'郑州', 'pid'=>2),

    array('id'=>4, 'name'=>'洛阳', 'pid'=>2),

    array('id'=>5, 'name'=>'安阳', 'pid'=>2),

    array('id'=>6, 'name'=>'林州', 'pid'=>5),

    array('id'=>7, 'name'=>'安阳县', 'pid'=>5),

    array('id'=>8, 'name'=>'内黄', 'pid'=>5),

    array('id'=>9, 'name'=>'滑县', 'pid'=>5),

    array('id'=>10, 'name'=>'城郊乡', 'pid'=>6),

    array('id'=>11, 'name'=>'湖南', 'pid'=>1),

    array('id'=>12, 'name'=>'长沙', 'pid'=>11),

    array('id'=>13, 'name'=>'湘潭', 'pid'=>11),

    array('id'=>14, 'name'=>'岳麓区', 'pid'=>12),

);

// 查询子树

function get_childs($id)

{

    global $addrs;

    $ret = array();

    foreach($addrs as &$addr)  // 此处使用 & 运算符,提高效率

    {

        if($addr['pid'] == $id)

        {

            $addr['children'] = get_childs($addr['id']);

            $ret[] = $addr;

        }

    }

    return $ret;

}

// test code

echo '<pre>';

print_r( get_childs(1) );

echo '<hr/>';

print_r($addrs);

javascript canvas 生成图片的方法

javascript canvas 生成图片的方法

先生成base64格式的图片 然后ajax传到后台 写入服务器文件夹即可

<!DOCTYPE HTML>
<html>

<body>
    <canvas id="myCanvas">
        your browser does not support the canvas tag
    </canvas>
    <script type="text/javascript">
    var canvas = document.getElementById('myCanvas');
    var ctx = canvas.getContext('2d');
    ctx.fillStyle = '#FF0000';
    ctx.fillRect(0, 0, 80, 100);

    var data = getBase64Image();
    console.log(data);

    function getBase64Image() {
        var canvas = document.getElementById('myCanvas');
        var dataURL = canvas.toDataURL("image/png");
        return dataURL
        // return dataURL.replace("data:image/png;base64,", "");
    }
    </script>
</body>

</html>

jquery mobiscroll移动端日期选择控件(无乱码)

jquery mobiscroll移动端日期选择控件(无乱码)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">

    <title>Mobiscroll日期时间中文精简实例 ( SnoopyChen修改增加中文支持 ceo@vmeitime.com )</title>

    <script src="dev/jquery-1.9.1.js"></script>

    <script src="dev/js/mobiscroll.core-2.5.2.js" type="text/javascript"></script>
	<script src="dev/js/mobiscroll.core-2.5.2-zh.js" type="text/javascript"></script>

	<link href="dev/css/mobiscroll.core-2.5.2.css" rel="stylesheet" type="text/css" />
	<link href="dev/css/mobiscroll.animation-2.5.2.css" rel="stylesheet" type="text/css" />
	<script src="dev/js/mobiscroll.datetime-2.5.1.js" type="text/javascript"></script>
	<script src="dev/js/mobiscroll.datetime-2.5.1-zh.js" type="text/javascript"></script>

	<!-- S 可根据自己喜好引入样式风格文件 -->
	<script src="dev/js/mobiscroll.android-ics-2.5.2.js" type="text/javascript"></script>
	<link href="dev/css/mobiscroll.android-ics-2.5.2.css" rel="stylesheet" type="text/css" />
	<!-- E 可根据自己喜好引入样式风格文件 -->

    <style type="text/css">
        body {
            padding: 0;
            margin: 0;
            font-family: arial, verdana, sans-serif;
            font-size: 12px;
            background: #ddd;
        }
        input, select {
            width: 100%;
            padding: 5px;
            margin: 5px 0;
            border: 1px solid #aaa;
            box-sizing: border-box;
            border-radius: 5px;
            -moz-box-sizing: border-box;
            -webkit-box-sizing: border-box;
            -webkit-border-radius: 5px;
        }
        .header {
            border: 1px solid #333;
            background: #111;
            color: white;
            font-weight: bold;
            text-shadow: 0 -1px 1px black;
            background-image: linear-gradient(#3C3C3C,#111);
            background-image: -webkit-gradient(linear,left top,left bottom,from(#3C3C3C),to(#111));
            background-image: -moz-linear-gradient(#3C3C3C,#111);
        }
        .header h1 {
            text-align: center;
            font-size: 16px;
            margin: .6em 0;
            padding: 0;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
        }
        .content {
            padding: 15px;
            background: #fff;
        }
       
    </style>

    <script type="text/javascript">
        $(function () {
			var currYear = (new Date()).getFullYear();	
			var opt={};
			opt.date = {preset : 'date'};
			//opt.datetime = { preset : 'datetime', minDate: new Date(2012,3,10,9,22), maxDate: new Date(2014,7,30,15,44), stepMinute: 5  };
			opt.datetime = {preset : 'datetime'};
			opt.time = {preset : 'time'};
			opt.default = {
				theme: 'android-ics light', //皮肤样式
		        display: 'modal', //显示方式 
		        mode: 'scroller', //日期选择模式
				lang:'zh',
		        startYear:currYear - 10, //开始年份
		        endYear:currYear + 10 //结束年份
			};

			$("#appDate").val('').scroller('destroy').scroller($.extend(opt['date'], opt['default']));
		  	var optDateTime = $.extend(opt['datetime'], opt['default']);
		  	var optTime = $.extend(opt['time'], opt['default']);
		    $("#appDateTime").mobiscroll(optDateTime).datetime(optDateTime);
		    $("#appTime").mobiscroll(optTime).time(optTime);
			
			//下面注释部分是上面的参数可以替换改变它的样式
			//希望一起研究插件的朋友加我个人QQ也可以,本人也建个群 291464597 欢迎进群交流。哈哈。这个不能算广告。
			// 直接写参数方法
			//$("#scroller").mobiscroll(opt).date(); 
			// Shorthand for: $("#scroller").mobiscroll({ preset: 'date' });
			//具体参数定义如下
		    //{
		    //preset: 'date', //日期类型--datatime --time,
		    //theme: 'ios', //皮肤其他参数【android-ics light】【android-ics】【ios】【jqm】【sense-ui】【sense-ui】【sense-ui】
										//【wp light】【wp】
		    //mode: "scroller",//操作方式【scroller】【clickpick】【mixed】
		    //display: 'bubble', //显示方【modal】【inline】【bubble】【top】【bottom】
		    //dateFormat: 'yyyy-mm-dd', // 日期格式
		    //setText: '确定', //确认按钮名称
		    //cancelText: '清空',//取消按钮名籍我
		    //dateOrder: 'yymmdd', //面板中日期排列格
		    //dayText: '日', 
		    //monthText: '月',
		    //yearText: '年', //面板中年月日文字
		    //startYear: (new Date()).getFullYear(), //开始年份
		    //endYear: (new Date()).getFullYear() + 9, //结束年份
		    //showNow: true,
		    //nowText: "明天",  //
		    //showOnFocus: false,
		    //height: 45,
		    //width: 90,
		    //rows: 3}

        });
    </script>
</head>

<body>
    <div class="header">
        <h1>Mobiscroll精简实例</h1>
    </div>

    <div class="content">

		<div class="demos">
			<label for="appDate">日期</label>
			<input type="text" name="appDate" id="appDate" />
		</div>
		<div class="demos">
			<label for="appDateTime">日期时间</label>
			<input type="text" name="appDateTime" id="appDateTime" />
		</div>
		<div class="demos">
			<label for="appTime">时间</label>
			<input type="text" name="appTime" id="appTime" />
		</div>
	</div>

</body>
</html>

css3 background-position手机端自适应

css3 background-position手机端自适应

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <title>
        Document
    </title>
    <style>
    .wrap {
        width: 1.28rem;
        height: 1.28rem;
        background: url(http://sandbox.runjs.cn/uploads/rs/155/azqeh6bj/w.png) no-repeat;
        background-size: 2.56rem 2.56rem;
        background-position: 0rem -1.3rem;
    }
    </style>
</head>

<body>
    <div class="wrap">
    </div>
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.js"></script>
    <script>
    (function(doc, win) {
        var docEl = doc.documentElement,
            resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
            /*如果屏幕尺寸发生了变化就会立即更新*/
            recalc = function() {
                /*     var clientWidth = docEl.clientWidth;*/
                var clientWidth = parseInt($('body').width());
                if (!clientWidth) return;
                docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
                /*部分安卓手机计算rem有误差 如果有误差 需要重新设置font-size 从而计算出正确的值*/
                var div = document.createElement('div');
                div.style.width = '1.4rem';
                div.style.height = '0';
                document.body.appendChild(div);
                var ideal = 1.4 * 20 * (clientWidth / 320);
                var rem = div.clientWidth;
                var scale = rem / ideal;
                /*因为css获取属性值只保留整数 */
                if (scale > 1.05 || scale < 0.95) {
                    docEl.style.fontSize = 20 * (clientWidth / 320) / scale + 'px';
                    document.body.removeChild(div);
                }
            };
        if (!doc.addEventListener) return;
        /*如果窗口改变了大小 手机旋转了都会重新修改font-size属性*/
        win.addEventListener(resizeEvt, recalc, false);
        doc.addEventListener('DOMContentLoaded', recalc, false);
    })(document, window);
    </script>
</body>

</html>

ps:先改background-size 确定好大小

sublime3中运行python文件

sublime3中运行python文件

tools->build system->new build stystem

粘贴下面代码
{
“cmd”:[“python.exe”, “-u”, “$file”],
“path”:”C:/Users/csq/AppData/Local/Programs/Python/Python36-32″, // 注意:路径根据自己的python安装路径而定
“file_regex”: “^[ ]*File \”(…*?)\”, line ([0-9]*)”,
“selector”: “source.python”
}

保存以后命名
然后在tools->build system 可以看到你刚刚保存的

然后就可以编译了 注意要utf-8格式 不然ctrl+b 编译不了

php ffmpeg视频和序列帧转化

php ffmpeg视频和序列帧转化

$cmd=shell_exec("ffmpeg -i ".__DIR__ . "/shipin1.mp4 -r 25 -q:v 2   ".__DIR__ . "/testxulie/%03d.jpg");
        print_r($cmd);
        exit();
       $cmd = shell_exec("ffmpeg -i ".__DIR__ . "/testxulie/%03d.jpg -c:v copy -c:a copy  ".__DIR__ . "/testxulie/1.mp4");
        print_r($cmd);
        exit();

ps:-c:v copy -c:a这个是保证无损压缩的 -q:v 2保证无损导出图片 如果导出图片无损 一般图片很大 最终图片再拼成视频都要压缩