[FFmpeg-user] Scaling a video with multiple different resolutions

Jesse Liu jesselfree at gmail.com
Fri Jan 13 09:37:59 EET 2017


of course, if you want to output a 852x480 video, you can do it by:  ffmpeg  -i video.webm -filter_complex “[0:v]split=2[out1][out2];[out1]trim=start=starttiem1:end=endtime1,scale=w='if(gt(a,1.775),852,trunc(480*a/2)*2)':h='if(lt(a,1.775),480,trunc(852/a/2)*2),pad=w=852:h=480:x='if(gt(a,1.775),0,(852-iw)/2)':y='if(lt(a,1.775),0,(480-ih)/2)':color=black[trim0];[out2]trim=start=starttiem2:end=endtime2,scale=w='if(gt(a,1.775),852,trunc(480*a/2)*2)':h='if(lt(a,1.775),480,trunc(852/a/2)*2),pad=w=852:h=480:x='if(gt(a,1.775),0,(852-iw)/2)':y='if(lt(a,1.775),0,(480-ih)/2)':color=black[trim1];[trim0][trim1]concat=n=1:v=1:unsafe=1:a=0[v]” -map [v] -map [0:a] -c:v libx264 -c:a aac out.mp4. 1.775 in the command is equal to 852/480

> On 13 Jan 2017, at 8:10 AM, Alex Speller <alex at alexspeller.com> wrote:
> 
> I have a webm file that has multiple different resolutions in it (it's a
> screen capture of a window that changes dimensions).
> 
> https://www.dropbox.com/s/ptueirabmmht0fr/4be7fdb7-d7e9-41b4-ba26-e20a3eeb6026.webm?dl=0
> 
> Is there any way to "normalize" the dimensions and output a video of a
> constant resolution, having e.g. black borders around the video when the
> resolutions change
> 
> If you play the video on the dropbox page above, in chrome or firefox, how
> that looks is what I'd like to output. Tried messing around with scale,
> setsar and setdar parameters but I can't figure out how to get output
> that's not just distorted
> 
> Any help appreciated, thanks!
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list