I need to batch process a bunch of videos to increase their height to 240, while maintaining aspect ratio. The team that almost completed the job:
$ avconv -threads 4 -ss 0.0 -i input.avi \ -map 0:0,0:0 -map 0:1,0:1 -vf "scale=-1:240" -y -f mpegts \ -async -1 -vcodec libx264 -vcodec libx264 -flags2 +fast \ -flags +loop -g 30 -bufsize 1024k \ -b 200k -bt 220k -qmax 48 -qmin 2 -r 20 -acodec libmp3lame \ -ab 44k -ar 44100 -ac 2 output.ts
The interesting part, as you can see, is -vf "scale=-1:240"
This works with video where the scaled width of the output image is even. Otherwise, you receive the following error message:
[libx264 @ 0x7fc4f8821e00] width not divisible by 2 (341x240)
How can I overcome this?
Edit: According to this link , I tried to use -vf "scale=trunc(oh/a/2)*2:240" , which displays the movie, but as a result the video quality is very poor.
Edit # 2: This is not a duplicate because it is incorrectly marked. This question was published much earlier than another.
source share