How to encode video in H264 format
来源:互联网 发布:数控机床模拟软件 编辑:程序博客网 时间:2024/06/11 23:03
Ffmpeg/x264 (profile High, level 3.0) (latest versions of x264)
We have successfully been using ffmpeg/libx264 with two pass encoding using the following commands:
infile ="video.avi" tmpfile="video_tmp.mp4" outfile="video.mp4" options="-vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \ -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \ -me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \ -flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \ -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\ -qmax 51 -qdiff 4" ffmpeg -y -i "$infile" -an -pass 1 -threads 2 $options "$tmpfile" ffmpeg -y -i "$infile" -acodec libfaac -ar 44100 -ab 96k -pass 2 -threads 2 $options "$tmpfile" qt-faststart "$tmpfile" "$outfile"
The last line 'qt-faststart' is optional. It doesn't hurt though and it even may save a little time on the server which is hosting the movie files.
Thanks to S0ma for the updated options.
Ffmpeg/x264 (profile High, level 3.0) (older versions)
Replace the options above with:
options="-vcodec libx264 -b 512k -bf 3 -subq 6 -cmp 256 -refs 5 -qmin 10 \ -qmax 51 -qdiff 4 -coder 1 -loop 1 -me hex -me_range 16 -trellis 1 \ -flags +mv4 -flags2 +bpyramid+wpred+mixed_refs+brdo+8x8dct \ -partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -g 250 \ -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71"
Ffmpeg/x264 (profile Baseline, level 3.0) (iPhone)
Replace the options above with:
options="-vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \ -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \ -me_method hex -subq 7 -trellis 1 -refs 5 -bf 0 \ -flags2 +mixed_refs -coder 0 -me_range 16 \ -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\ -qmax 51 -qdiff 4"
Mencoder & mp4creator
Thanks to Martin Bündgens for the following PHP script.
system("mencoder ". $file_input ." -o ". $file_output_raw ." -ovc x264 -x264encopts bitrate=300:threads=auto:subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b -vf bmovl=0:0:mylogo.fifo,scale=". $nw .":". $nh .",harddup -oac faac -faacopts br=56:mpeg=4:object=2 -srate 44100 -ofps 24000/1001");system("mplayer ". $file_output_raw. " -dumpaudio -dumpfile ". $file_output_aac ."");system("mplayer ". $file_output_raw. " -dumpvideo -dumpfile ". $file_output_h264 ."");system("mp4creator -create=". $file_output_aac. " ". $file_output ."");system("mp4creator -create=". $file_output_h264. " -rate=23.976 ". $file_output ."");system("mp4creator -hint=1 ". $file_output ."");system("mp4creator -hint=2 ". $file_output ."");system("mp4creator -optimize ". $file_output ."");
Telestream Episode Engine Pro 5
Files transcoded by a Telestream Episode Engine Pro 5 are reported to work. The files are H264/AAC in an MP4 container. They are compatible with both Flash and iPod.
Encoding H264 on Tiger
Here is a little wisdom snippet from challefredde:
I'm using different tools but mostly this combination: On Mac OS X 10.4 Tiger:
- Perian plugin installed (watch almost all videos in Quicktime)
- Mpeg Streamclip from Squared 5
- x264 Quicktime codec. Encodes better h264 videos than Quicktime's built-in.
- QTFastStart
Video: 900 kbit/s, Audio: AAC, stereo 96 kbit/s, Res: 640x360 (widescreen)
The video plays fine on iPod's.
- How to encode video in H264 format
- How to format DateTime in PowerShell window
- How to format date/datetime in struts2
- How to format Currency in Java
- How to encode decode String in Java base64 Encoding
- How to format strings in an array in ruby?
- How to play video in cocos2dx with DirectShow
- How to Create an Video Player in jQuery, HTML5 & CSS3
- How to play video with AVPlayerViewController (AVKit) in Swift
- How To Print Concurrent Requests in PDF Format
- How to solve: stdin: not in gzip format
- encode an Url to Uft8 format
- How to URL-encode/decode Strings (NSString) in Objective-C (iOS)[转载]
- How to save data in ASCII format in ADS for use in MATLAB
- How to POST data in JSON format in ExtJS 4 Ext.data.store
- How to format date for display or to use in a shell script
- How to Write a Video Player in Less Than 1000 Lines
- How To Avoid ORA-04030/ORA-12500 In 32 Bit Windows Environment [Video] [ID 373602.1]
- MJExtersion的几个用法
- 不能反序列化--org.hibernate.type.SerializationException: could not deserialize
- 自定义segue
- java包装类与常量池
- 打开cmd命令窗口
- How to encode video in H264 format
- myeclipse在部署项目中报错:Errors occurred during the build.Errors running builder 'Deployment
- 几何画板中怎样绘制圆弧
- srs之dvr
- 协程的C实现
- Android TextView 字符间距设置
- 确定这段文字前面哪几个字要显示红色
- 关于pcd_viewer
- C语言变量类型