0
votes

i want convert video from any format to mp4. so i am using command: ffmpeg -i ttt.mp4 -vcodec copy -acodec copy test.mp4 this is working perftectly but now i also add scale in this -s 320:240.

There also many other command for convert LIKE : ffmpeg -i inputfile.avi -s 320x240 outputfile.avi

but after convert by this command video not play in html5 player

BUT this is not working so tell me in my command how i add scale;

So please provide me solution for this .

Thanks in advance.

2

2 Answers

2
votes

You have several problems:

  • In your command, you have -vcodec copy you cannot scale video without reencoding.
  • In the command you randomly found on the Internet, they are using AVI, which is not HTML5-compatible.

What you should do is:

ffmpeg -i INPUT -s 320x240 -acodec copy OUT.mp4
1
votes

Adding to Timothy_G:

Video copy will ignore the video filter chain of ffmpeg, so no scaling is available (man ffmpeg is a great source of information that you will not find on Google). Notice that once you start decoding-filtering-encoding (i.e., no copy) the process will be much slower (x100 time slower or even more). The libx264 is recommended if you want compatibility with all browsers.

$ ffmpeg -i INPUT -s 320x240 -threads 4 -c:a copy -c:v libx264 OUT.mp4

vp9 will provide nearly 50% extra bandwidth saving, but only for supported browsers (Firefox/Chrome), and the encoding will much slower compared to libx264 (that itself is much slower that v:c copy):

$ ffmpeg -i INPUT -s 320x240 -c:a copy -c:v vp9 OUT.webm

Notice that there is a set of formats (containers) accepted by browsers (most admit mp4, some also webm, ...) and for each format there is a set of audio/video codecs accepted. For example you can use mp3 or aac with an mp4 file (container), but not with webm files.

http://en.wikipedia.org/wiki/HTML5_video#Supported_video_formats