4

There have been reports of a malformed h264 video file causing iOS devices to hang or crash (I've added the link in plaintext to avoid accidental clickthroughs, play at your own risk: http://www.apps4iphone.net/videocrash.html). I am trying to reverse engineer this file to understand why and how it harms an iOS device.

There doesn't appear to be anything abnormal with the file looking at it with Mediainfo Mac:

* * * MediaInfo Mac 0.7.36.0 file analysis report.
* * * MediaInfo Mac is ©2010 by Diego Massanti - http://mediainfo.massanti.com
* * * MediaInfoLib by Jerome Martinez - http://mediainfo.sourceforge.net
Created on: Nov 22, 2016, 1:55:04 PM EST
Report for file: IMG_0942.mp4

General / Container Stream #1
    Total Video Streams for this File.................1
    Total Audio Streams for this File.................1
    Video Codecs Used.................................AVC
    Audio Codecs Used.................................AAC LC
    File Format.......................................MPEG-4
    Play Time.........................................5s 6ms
    Total File Size...................................527 KiB
    Total Stream BitRate..............................863 Kbps
Video Stream #1
    Codec (Human Name)................................AVC
    Codec (FourCC)....................................avc1
    Codec Profile.....................................Baseline@L3.0
    Frame Width.......................................480 pixels
    Frame Height......................................480 pixels
    Frame Rate........................................25.000 fps
    Total Frames......................................126
    Display Aspect Ratio..............................1.000
    Scan Type.........................................Progressive
    Color Space.......................................YUV
    Codec Settings (Summary)..........................1 Ref Frames
    QF (like Gordian Knot)............................0.137
    Codec Settings (CABAC)............................No
    Codec Settings (Reference Frames).................1
    Video Stream Length...............................5s 6ms
    Video Stream BitRate..............................789 Kbps
    Video Stream BitRate Mode.........................VBR
    Bit Depth.........................................8 bits
    Video Stream Size.................................486 KiB (92%)
    Video Stream Title................................Core Media Video
    Date of Original Encoding.........................UTC 2016-11-17 20:14:29
Audio Stream #1
    Codec.............................................AAC
    Codec (FourCC)....................................40
    Audio Stream Length...............................4s 504ms
    Audio Stream BitRate..............................72.0 Kbps
    Audio Stream BitRate Mode.........................CBR
    Number of Audio Channels..........................1
    Audio Channel's Positions.........................Front: C
    Sampling Rate.....................................44.1 KHz
    Audio Stream Size.................................39.2 KiB (7%)
    Audio Stream Title................................Core Media Audio
    Date of Original Encoding.........................UTC 2016-11-17 20:14:29

ffprobe output:

➜  Downloads ffprobe IMG_0942.mp4
ffprobe version 3.2 Copyright (c) 2007-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.100 / 57. 64.100
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_0942.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp41mp42isom
    creation_time   : 2016-11-17T20:14:29.000000Z
  Duration: 00:00:05.01, start: 0.000000, bitrate: 862 kb/s
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 71 kb/s (default)
    Metadata:
      creation_time   : 2016-11-17T20:14:29.000000Z
      handler_name    : Core Media Audio
    Stream #0:1(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 480x480, 794 kb/s, 25.17 fps, 25 tbr, 12800 tbn, 25600 tbc (default)
    Metadata:
      creation_time   : 2016-11-17T20:14:29.000000Z
      handler_name    : Core Media Video

I'm not sure of the best way to read the video file's header contents on a Mac. But what would cause this video to hang an iOS device? Is it a malformed header? Corrupted metadata or video stream? Also note that this does not crash Quicktime on Mac or Safari/AVFoundation on the iOS Simulator.

1

I've been looking into this same issue and although I have not found exactly what is causing the problem. I have tried to use ffmpeg to find a little info. When running:

ffmpeg -v error -i IMG_0942.mp4 -f null - 2> IMG_0942.mp4.log

it yields the following:

[h264 @ 0x8f4720] top block unavailable for requested intra4x4 mode -1 at 0 0 
[h264 @ 0x8f4720] error while decoding MB 0 0

Not sure if you know how to read that or what it means (I don't), but it does help to demonstrate a way to find where the issue is.

Let me know if you make anymore progress on this issue.

  • PS. just checked and IOS 10.2 fixed the issue. – MikeSchem Dec 14 '16 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.