ffmpeg - How to transcode video stream by changing only the resolution? -
i transcode video stream using ffmpeg tool , change video stream resolution, i.e. video , audio parameters should remain same.
according man page of ffmpeg following command line should provide desired result:
ffmpeg -i input.mp4 -vcodec copy -acodec copy -s wxh output.avi the video codec of input stream compatible avi container.
the actual result resolution remains unchanged , seems stream repacked in avi container.
the resolution of output stream changed without -vcodec copy option, video codec changed: h264 (constrained baseline) - > mpeg4 (simple profile).
when copy video stream, cannot change of paramters, since… well, you're copying it. ffmpeg won't touch in way, can't change dimensions, frame rate, et cetera.
also, ffmpeg chooses default video codec if don't specify one. avi files, that's mpeg4.
if want h.264 video, choose -c:v libx264 instead (or -vcodec libx264 same). if need keep original profile, use -profile:v baseline.
two things:
when change size, recode video. lowers quality , might considerably harm video. compensate this, might need set higher quality level. setting constant rate factor below default of 23, e.g.
-crf 20. experiment , see how video looks like. if have time, add-preset slow(orslower,veryslow), give better compression.not matters in case, since input uses constrained baseline profile, note h.264 in avi not supported, @ least when using b pictures. baseline doesn't support b pictures though, should fine. happen file can't played on devices or players if use main profile or above. rather mux mp4 or mkv container, if input file mp4 anyway.
Comments
Post a Comment