Video resolution transcoding (ffmpeg)

When contacting video services, video resolution is an important issue that has to be faced. At present, all major video websites or small websites and systems have the most basic function of video resolution. Users can play differently according to their own network conditions. Rate videos, except for some websites that play videos of different resolutions according to the user’s network conditions (this involves streaming media), basically use the user’s own resolution, which needs to be converted according to the several resolutions adopted by the current system. To encode the corresponding video, when the user switches the resolution, the path directly points to the corresponding video. The video decoding still uses the ffmpeg plug-in, and I use the ffmpeg.exe which is free of installation.

ffmpeg.exe: Baidu SkyDrive

Transcode 1080p

ffmpeg -i test.mp4 -y -strict -2 -b 6000k -bufsize 6000k -an -c:v libx264 -vf scale=1920:1080  test-1080.mp4

Transcode 720p

ffmpeg -i test.mp4 -y -strict -2 -b 3000k -bufsize 3000k -an -c:v libx264 -vf scale=1280:720 test-720.mp4

Parameter introduction

  1. ffmpeg: represents the start of the ffmpeg plug-in, if you are using the free installation ffmpeg.exe, please add the path and suffix name
  2. test.mp4: original video file
  3. -y: Whether to overwrite the file, I usually write
  4. -b: The video bit rate represents the quality and size of the video. I usually set the HD to 6000k, which is more than 10,000. It is basically indistinguishable from the naked eye on the computer screen. Of course, projection is another matter
  5. -bufsize: Set the video bit rate buffer size, which is the same as -b
  6. -c:v: set the video format, the general video is libx264
  7. -vf: Set the video filter to cooperate with the scale behind
  8. -scale: Set the video resolution
  9. Finally set the target file

If you need to transcode other resolution videos, you can set the scale and the bit rate can be defaulted

Guess you like

Origin blog.csdn.net/qq_38306425/article/details/102647311