mattrogowski
Well-known member
- Affected version
- 2.2.9
If you have a .mp4 file encoded as 3gp (not a .3gp video), it will not be accepted as a valid video file. I believe this encoding is used when sending a video via MMS/iMessage and over a cellular network.
First bytes of a .mp4 video that works:
First bytes of a .mp4 video that doesn't work:
This is from
The second video doesn't match this regex, however if you add
See in regex101 (with the
No 3gp in regex:
With 3gp in regex:
We've had this crop up on two separate forums.
First bytes of a .mp4 video that works:
ftypmp42mp41mp42isom
First bytes of a .mp4 video that doesn't work:
ftyp3gp53gp5isom
This is from
XF\Http\Upload::analyzeVideo()
:
PHP:
$mp4Ftypes = [
'avc1', 'f4v', 'iso2', 'iso6', 'isom', 'mmp4', 'mp4v', 'msnv',
'ndas', 'ndsc', 'ndsh', 'ndsm', 'ndsp', 'ndss', 'ndxc', 'ndxh',
'ndxm', 'ndxp', 'ndxs', 'xavc'
// mp41/2 handled via regex
];
$mp4FtypesRegex = implode('|', $mp4Ftypes);
// Signatures adapted from: https://www.garykessler.net/library/file_sigs.html
if (preg_match('#^(....)ftyp(M4V |qt |mp4[0-9]|' . $mp4FtypesRegex . ')#i', $preamble, $match))
The second video doesn't match this regex, however if you add
'3gp'
to $mp4Ftypes
, it does.See in regex101 (with the
(....)
bit removed as it doesn't seem to understand that):No 3gp in regex:
With 3gp in regex:
We've had this crop up on two separate forums.