FFMPEG resize video not working in browser or IOS

2019-04-15 04:51发布

问题:

I have tried to compress video using FFMPEG command and it's compress properly but I couldn't see in browser as like original video.

I have used below all command but didn't success.

ffmpeg -i /var/www/html/test.mp4 -c:v copy -bsf:v h264_mp4toannexb -an /var/www/html/test123.mp4

ffmpeg -i /var/www/html/test.mp4 -s 640x480 -c:v copy -bsf:v h264_mp4toannexb -an /var/www/html/test123.mp4

ffmpeg -i /var/www/html/test.mp4 -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis /var/www/html/test111.mp4

ffmpeg -i /var/www/html/test.mp4 -s 720x960 -b:v 120k -vcodec mpeg1video -acodec copy /var/www/html/test112.mov

ffmpeg -i INPUT -attach /var/www/html/test.mp4 -metadata:s:2 mimetype=application/x-truetype-font /var/www/html/test2.mp4

ffmpeg -y -i "/var/www/html/test.mp4" -c:v libx264 -preset slow -pix_fmt yuv420p -c:a libvo_aacenc -b:a 128k "/var/www/html/test2222.mp4"

ffmpeg -y -i "/var/www/html/test.mp4" -ar 22050 -ab 512 -b 700k -f mp4 -s 514*362 -strict -2 -c:a aac "/var/www/html/test2222222.mp4"

ffmpeg -i /var/www/html/test.mp4 -c copy -movflags +faststart /var/www/html/test222.mp4

ffmpeg -i /var/www/html/test.mp4 -c copy -movflags +faststart /var/www/html/test222.mp4

ffmpeg -i /var/www/html/test.mp4 -s 720x480 -c:a copy /var/www/html/test22.mp4

ffmpeg video compressed but not playing in browser

ffmpeg -i /var/www/html/test.mp4 -c:v libx264 /var/www/html/test111.mp4

ffmpeg -i /var/www/html/test.mp4 -r 60 -s hd720 /var/www/html/test111.mp4

Do you have any Idea? How to compress video as like Original with work in All browser?

回答1:

try something like:

./ffmpeg -y -i /var/www/html/test.mp4 -s 1280x720 -c:v libx264 -b 3M -strict -2 -movflags faststart /var/www/html/testOBM.mp4

The above will give you a 1280x720 output, at 3Mbps using h264 in an mp4 container, and will then do a second pass to move the moov element to the front of the file enabling it to start streaming faster (see this answer for some more detail).

You may want to adjust the framesize and bitrate depending on quality and connection speed you want to support