dfaker / WebmGenerator

UI and Automation to cut, filter and join high quality webms, mp4s or gifs.
Mozilla Public License 2.0
524 stars 33 forks source link

Text like drawtext is stretched when dealing with stretched 4:3 to 16:9 videos #38

Closed LolicoreExpress closed 3 years ago

LolicoreExpress commented 3 years ago

So I'm not super well versed in everything video format and all that, but basically I have these videos that are 1440x1080 but are being displayed as 16:9 (as they should), the only thing is that when using drawtext, the text will also get stretched as you can see. Capture dโ€™รฉcran 2021-10-11 192527 Hopefully it's possible to have the text remain consistent even when dealing with that kind of format / resolution ๐Ÿ˜Š

dfaker commented 3 years ago

I suspect the DAR and or SAR are non-square, could you let me know the output of the command:

ffmpeg -i "videofilepath\videoName.mp4"

There should be a line in the output like: Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 638x360 [SAR 1:1 DAR 319:180], 371 kb/s, 29.97 fps...

So I can find a similarly squashed file to test with?

LolicoreExpress commented 3 years ago

Of course, here's what I get.

Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      handler_name    : Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1440x1080 [SAR 4:3 DAR 16:9], 3687 kb/s, 29.97 fps, 29.97 tbr, 60k tbn (default)
    Metadata:
      handler_name    : Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
  Stream #0:2(eng): Data: bin_data (tx3g / 0x67337874)
dfaker commented 3 years ago

Seems like drawText always operates on square pixels no matter what the SAR, I've added a new Make pixel SAR 1/1 filter in https://github.com/dfaker/WebmGenerator/commit/5d54f735cbf19802c9dadecb52a38bd5040e3ec9 you can use early by pasting those lines at the top of your src/filterSpecs.json (after the opening square bracket) or wait for it to be bundled in the next release.

LolicoreExpress commented 3 years ago

That's perfect. Thank you as always. ๐Ÿ˜„