ffmpeg转成h264编码格式、moov(meta数据)移动到头部、码率做一定压缩、分辨率也降下来

ffmpeg -i test.mp4 -threads 4 -vcodec mpeg4 -b:v 1000k test_A1.mp4

ffmpeg -i test.mp4 -threads 8 -vcodec mpeg4 -b:v 800k  test_A2.mp4

ffmpeg -i test.mp4 -threads 8 -vcodec mpeg4 -b 200k  test_A3.mp4





--开启8个线程,压缩码率-crf越小清晰度越高
ffmpeg -i test.mp4 -threads 8 -crf 22 -y  -vcodec mpeg4 -strict experimental test_B1.mp4

ffmpeg -i test.mp4 -threads 8 -crf 26 -y  -vcodec mpeg4 -strict experimental test_B2.mp4

ffmpeg -i test.mp4 -threads 8 -crf 28 -y  -vcodec mpeg4 -strict experimental test_B3.mp4

ffmpeg -i test.mp4 -threads 8 -crf 30 -y  -vcodec mpeg4 -strict experimental test_B4.mp4



--转h264。-s 640*360
--用的:ffmpeg -i  test.mp4  -c:v libx264 -b 600k -r 25 -s 640*360 -ab 48k -strict -2 test_ok.mp4  
ffmpeg -i  test.mp4 -threads 8 -c:v libx264 -movflags faststart -b 200k -r 25 -ab 48k -strict -2 test_C1.mp4

ffmpeg -i  test.mp4 -c:v libx264 -movflags faststart -b 600k -r 25 -ab 48k -strict -2 test_C2.mp4

ffmpeg -i  test.mp4 -threads 2 -c:v libx264 -movflags faststart -b 600k -r 25 -ab 48k -strict -2 test_C3.mp4

--发现threads加了没什么用,反而感觉有点慢似的
ffmpeg -i  test.mp4 -c:v libx264 -movflags faststart -b 600k -r 25 -s 640*360 -ab 48k -strict -2 test_C4.mp4

ffmpeg -i  C:\Users\guestAdmin\Desktop\K空文件夹\A00000592C0B5B\20180610\IMG_20180610104643.mp4 -c:v libx264 -b 600k -r 25 -s 1280*720 -ab 48k -strict -2 test_C5.mp4


ffmpeg -i  DreamItPossible.mp4 -c:v libx264 -movflags faststart -b 300k -r 25 -s 640*360 -ab 48k -strict -2 test_C5.mp4

ffmpeg -i  DreamItPossible.mp4  -threads 8 -c:v libx264 -movflags faststart -b 300k -r 25 -s 320*240 -ab 48k -strict -2 test_C6.mp4




--支持边下载边放:
qt-faststart test_c4.mp4 test_D1.mp4

qt-faststart DreamItPossible.mp4 test_D2.mp4

-- -movflags faststart 
-- http://saas.ihaihong.cn/YinShiPin/upload/FTP/862107034362822/20180615/filesIMG_20180615193440.mp4
ffmpeg -i  862107034362822\20180615\filesIMG_20180615193440-old.mp4 -c:v libx264 862107034362822\20180615\filesIMG_20180615193440-264.mp4
qt-faststart 862107034362822\20180615\filesIMG_20180615193440-264.mp4 862107034362822\20180615\filesIMG_20180615193440.mp4


ffmpeg -i  862107034362822\20180615\filesIMG_20180615193440-old.mp4 -c:v libx264 -movflags faststart 862107034362822\20180615\filesIMG_20180615193440.mp4

--转载请注明,海宏软件,iHaihong.cn
ffmpeg -i  862107034362822\20180615\filesIMG_20180615183646-old.mp4 -c:v libx264 -movflags faststart 862107034362822\20180615\filesIMG_20180615183646.mp4

  

mp4看着是mp4扩展名,但是编码格式有很多,比如3gp、MP4、MP42、avc、xvid等等,MP4要在html5网页上用<video src="xxx.mp4" />播放,需要这两点:

1:moov元数据要放在前面,通过 -movflags faststart 实现。

2:格式需要是h264的。

这样随便用个<video src="xxx.mp4" autoplay="autoplay"/>就能播放了。

 

posted @ 2018-06-15 23:29  海宏软件  阅读(591)  评论(0编辑  收藏  举报