imputnet / cobalt

best way to save what you love
https://cobalt.tools
GNU Affero General Public License v3.0
15.85k stars 1.3k forks source link

Twitter videos encoded with `Twitter-vork muxer` don't play properly on Apple devices #172

Closed dumbmoron closed 11 months ago

dumbmoron commented 1 year ago

some videos encoded with Twitter-vork muxer (most videos on Twitter are usually encoded with "Vireo Eyes" / "Vireo Ears") appear significantly shorter than they actually are when viewed/downloaded on iOS ffprobe (example):

  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 720x1556, 884 kb/s, SAR 1:1 DAR 180:389, 37.13 fps, 60 tbr, 6k tbn (default)
    Metadata:
      handler_name    : Twitter-vork muxer
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : Twitter-vork muxer
      vendor_id       : [0][0][0][0]

remuxing it fixes it, with some DTS warnings:

$ ffmpeg -i video.mp4 -map 0 -c copy out.mp4

[mp4 @ 0x556f47d7d080] Non-monotonous DTS in output stream 0:0; previous: 107200, current: 107000; changing to 107201. This may result in incorrect timestamps in the output file.
[mp4 @ 0x556f47d7d080] Non-monotonous DTS in output stream 0:0; previous: 1655320, current: 1655120; changing to 1655321. This may result in incorrect timestamps in the output file.
[mp4 @ 0x556f47d7d080] Non-monotonous DTS in output stream 0:0; previous: 1691320, current: 1691120; changing to 1691321. This may result in incorrect timestamps in the output file.
[mp4 @ 0x556f47d7d080] Non-monotonous DTS in output stream 0:0; previous: 1763340, current: 1763140; changing to 1763341. This may result in incorrect timestamps in the output file.
[mp4 @ 0x556f47d7d080] Non-monotonous DTS in output stream 0:0; previous: 1799340, current: 1798940; changing to 1799341. This may result in incorrect timestamps in the output file.
[mp4 @ 0x556f47d7d080] Non-monotonous DTS in output stream 0:0; previous: 1835140, current: 1835140; changing to 1835141. This may result in incorrect timestamps in the output file.
[mp4 @ 0x556f47d7d080] Non-monotonous DTS in output stream 0:0; previous: 1871140, current: 1871140; changing to 1871141. This may result in incorrect timestamps in the output file.
[mp4 @ 0x556f47d7d080] Non-monotonous DTS in output stream 0:0; previous: 1907340, current: 1907140; changing to 1907341. This may result in incorrect timestamps in the output file.
[mp4 @ 0x556f47d7d080] Non-monotonous DTS in output stream 0:0; previous: 1943340, current: 1943140; changing to 1943341. This may result in incorrect timestamps in the output file.
[mp4 @ 0x556f47d7d080] Non-monotonous DTS in output stream 0:0; previous: 2015160, current: 2015160; changing to 2015161. This may result in incorrect timestamps in the output file.
wukko commented 11 months ago

jesus christ this is a mess

wukko commented 11 months ago

quicktime on mac can't play such videos at all

image
wukko commented 11 months ago

they mixed up container info and quicktime (rightfully) refuses to play it. to fix that, video has to be copied over into a proper container (-c copy in ffmpeg).

wouldn't hurt doing this for all twitter videos...

wukko commented 11 months ago

this is a more correct way of saying "twitter fucked up the video container in their muxer" btw