Hi everyone i'm trying to resize width and height of certain input with fluent ffmpeg to 768x1366 (basically to show it in vertical mode), so i have to also change its display_aspect_ratio which i happen to know is 0.562225476.
The issue here is that, according to fluent-ffmpeg doc, if i set a fix size, it wont change the aspect ratio, but it wont work either if I use ?
to automatic mode. This is my code:
ffmpeg({source: req.file.path})
.withFps(30)
.toFormat('mp4')
.size("768x?")
.aspect(0.562225476)
Console command:
ffmpeg -i tmp/video.mp4 -y -r 30 -filter:v scale=w=768:h=1366 -f mp4 ./src/internal/media/video.mp4
So when i check the display_aspect_ratio with ffprobe
it's still 4:3 (as source file).
If I do not add the .aspect()
option, the command is exactly the same...so it's not considering it.
I've also tried:
ffmpeg({source: req.file.path})
.withFps(30)
.toFormat('mp4')
.size('768x1366')
.addOptions('-vf setdar=0.562225476')
And command here ends up being ffmpeg -i tmp/video.mp4 -y -r 30 -filter:v scale=w=768:h=1366 -f mp4 -vf setdar=0.562225476 ./src/internal/media/video.mp4
, so it seemed ok, but when I check with ffprobe it did not apply width and height changes.
The command I really need is some kind of : ffmpeg -i video.mp4 -vf scale=768:1766,"setdar=0.562225476" video2.mp4
which changes both, widthXheight and display_aspect_ratio