( ! ) Deprecated: Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers. in /var/www/html/wp-includes/functions.php on line 6131
Call Stack
#TimeMemoryFunctionLocation
10.0000484240{main}( ).../index.php:0
20.0000484592require( '/var/www/html/wp-blog-header.php ).../index.php:17
30.09614096000require_once( '/var/www/html/wp-includes/template-loader.php ).../wp-blog-header.php:19
40.09754124992include( '/var/www/html/wp-content/themes/twentyfifteen/single.php ).../template-loader.php:125
50.09754124992get_header( $name = ???, $args = ??? ).../single.php:10
60.09764125208locate_template( $template_names = [0 => 'header.php'], $load = TRUE, $load_once = TRUE, $args = [] ).../general-template.php:48
70.09764125304load_template( $_template_file = '/var/www/html/wp-content/themes/twentyfifteen/header.php', $load_once = TRUE, $args = [] ).../template.php:749
80.09764125848require_once( '/var/www/html/wp-content/themes/twentyfifteen/header.php ).../template.php:814
90.09774133256wp_head( ).../header.php:18
100.09774133256do_action( $hook_name = 'wp_head' ).../general-template.php:3197
110.09774133472WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
120.09774133472WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
130.09794136888wp_enqueue_scripts( '' ).../class-wp-hook.php:341
140.09794136888do_action( $hook_name = 'wp_enqueue_scripts' ).../script-loader.php:2311
150.09794137104WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
160.09794137104WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
170.09804138992twentyfifteen_scripts( '' ).../class-wp-hook.php:341
180.09824140512wp_style_add_data( $handle = 'twentyfifteen-ie', $key = 'conditional', $value = 'lt IE 9' ).../functions.php:440
190.09824140512WP_Styles->add_data( $handle = 'twentyfifteen-ie', $key = 'conditional', $value = 'lt IE 9' ).../functions.wp-styles.php:245
200.09824140512WP_Dependencies->add_data( $handle = 'twentyfifteen-ie', $key = 'conditional', $value = 'lt IE 9' ).../class-wp-styles.php:385
210.09824140512_deprecated_argument( $function_name = 'WP_Dependencies->add_data()', $version = '6.9.0', $message = 'IE conditional comments are ignored by all supported browsers.' ).../class-wp-dependencies.php:317
220.09824146464wp_trigger_error( $function_name = '', $message = 'Function WP_Dependencies->add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:5925
230.09824266000trigger_error( $message = 'Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:6131

( ! ) Deprecated: Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers. in /var/www/html/wp-includes/functions.php on line 6131
Call Stack
#TimeMemoryFunctionLocation
10.0000484240{main}( ).../index.php:0
20.0000484592require( '/var/www/html/wp-blog-header.php ).../index.php:17
30.09614096000require_once( '/var/www/html/wp-includes/template-loader.php ).../wp-blog-header.php:19
40.09754124992include( '/var/www/html/wp-content/themes/twentyfifteen/single.php ).../template-loader.php:125
50.09754124992get_header( $name = ???, $args = ??? ).../single.php:10
60.09764125208locate_template( $template_names = [0 => 'header.php'], $load = TRUE, $load_once = TRUE, $args = [] ).../general-template.php:48
70.09764125304load_template( $_template_file = '/var/www/html/wp-content/themes/twentyfifteen/header.php', $load_once = TRUE, $args = [] ).../template.php:749
80.09764125848require_once( '/var/www/html/wp-content/themes/twentyfifteen/header.php ).../template.php:814
90.09774133256wp_head( ).../header.php:18
100.09774133256do_action( $hook_name = 'wp_head' ).../general-template.php:3197
110.09774133472WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
120.09774133472WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
130.09794136888wp_enqueue_scripts( '' ).../class-wp-hook.php:341
140.09794136888do_action( $hook_name = 'wp_enqueue_scripts' ).../script-loader.php:2311
150.09794137104WP_Hook->do_action( $args = [0 => ''] ).../plugin.php:522
160.09794137104WP_Hook->apply_filters( $value = '', $args = [0 => ''] ).../class-wp-hook.php:365
170.09804138992twentyfifteen_scripts( '' ).../class-wp-hook.php:341
180.12684267104wp_style_add_data( $handle = 'twentyfifteen-ie7', $key = 'conditional', $value = 'lt IE 8' ).../functions.php:444
190.12684267104WP_Styles->add_data( $handle = 'twentyfifteen-ie7', $key = 'conditional', $value = 'lt IE 8' ).../functions.wp-styles.php:245
200.12684267104WP_Dependencies->add_data( $handle = 'twentyfifteen-ie7', $key = 'conditional', $value = 'lt IE 8' ).../class-wp-styles.php:385
210.12684267104_deprecated_argument( $function_name = 'WP_Dependencies->add_data()', $version = '6.9.0', $message = 'IE conditional comments are ignored by all supported browsers.' ).../class-wp-dependencies.php:317
220.12684267424wp_trigger_error( $function_name = '', $message = 'Function WP_Dependencies->add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:5925
230.12694267648trigger_error( $message = 'Function WP_Dependencies-&gt;add_data() was called with an argument that is <strong>deprecated</strong> since version 6.9.0! IE conditional comments are ignored by all supported browsers.', $error_level = 16384 ).../functions.php:6131

使用H264编码转换视频

使用H264编码转换视频

H264(即MPEG4 AVC)是目前比较流行的视频编码格式,相对MPEG2编码而言,在画质大致相同的情况下能将视频大小再压缩到50%~25%,即如果一个MPEG2(如DVD)视频大小是1GB,用H264编码能缩小到250MB左右。另外H264编码的视频还能直接在浏览器(如Chrome)和移动设备(如iPhone、Android手机)上直接播放。
如果你有一堆家庭视频(旧款的家用DV一般是MPEG2格式)想刻录到光盘保存,或者有一堆手机不直接支持的格式的视频想在手机上播放,那么用H264编码转换和压缩它们是一个不错的选择。

mencoder 是一个很方便的视频编码程序,它几乎支持所有的视频格式,而且参数丰富、速度快。

首选你需要安装 mencoder 程序(下面分别是 Archlinux, Fedora, Ubuntu下的安装方式):

$ sudo pacman -S memcoder
$ sudo yum install mencoder
$ sudo apt-get install mencoder

然后就可以查看你当前系统支持哪些视频和音频编码器,以及支持哪些封装格式了:

$ mencoder -ovc help
$ mencoder -oac help
$ mencoder -of help

如果看到有x264视频编码器、有mp3lame音频编码器、以及有mp4封装格式,那么就可以开始下面的编码转换了,否则你可能需要安装相应的音频和视频编码器,一般安装 ffmpeg 组件就会同时附带这些编码器。

压缩一段MPEG2视频:

$ mencoder m001.mpg -o m001.mp4 -oac mp3lame -ovc x264 -of lavf -vf lavcdeint

上面命令中的 m001.mpg 和 m001.mp4 分别是输入和输出文件名,-oac 用于指定音频编码器,-ovc 指定视频编码器, -of 指定输出文件封装方式,lavf表示输出文件封装方式由输出的文件名(的扩展名)决定(比如m001.mp4表示用mp4封装,m001.avi表示用avi封装),最后 -vf lavcdeint 参数用于去除视频中的拉丝条纹(锯齿纹),如果没有的话不要这个参数也可以。

h264的编码过程比较耗时,比如 AMD 四核2.8G的编码速度大概是 30fps,大概是视频正常播放所需的时间。

如果待编码转换的视频文件很多,则最好写一个批量处理的脚本:

#!/bin/bash
find . -type f ( -name "*.mpg" -o -name "*.mpeg" )|while read line;do
echo $line
mencoder $line -o ${line}.mp4 -oac mp3lame -ovc x264 -of lavf -vf lavcdeint
done

执行上面的脚本会将当前目录里所有后缀名为“mpg”和“mpeg”的视频编码为H264格式。

最后,除了mencoder之外,还可以使用ffmpeg来编码,详细方法请参考这里

One thought on “使用H264编码转换视频”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.