Answers.Body: <p>There are several things we can note here:</p>
  <ol>
  <li>The file stops playing after 0:05:30.</li>
  <li>If you remux the file (mkvtools for example) you do have 5:30 displayed as the length.</li>
  <li>The original file does in fact show the ridiculous length.</li>
  </ol>
  <p>So, although it is a funny joke, it is not as cool as I first thought. Nobody has figured out how to do an infinite loop of frames or anything similar to that. This appears to be just a header of the file that is not matching the data.</p>
  <p>How does the player (or most tools) figure out the length of the video? They do not read the whole file, otherwise the load times of files would be impractical. So at the start of the file there is a marker that says the length, and the player just trusts it.</p>
  <p>Let's run through the maths:</p>
  <pre><code>596523:14:07.00 = ((596523*60)+14)*60+7 = 2147483647 seconds
  2147483647 (base 10) = 7FFFFFFF (base 16)
  </code></pre>
  <p>Oh, that's a nice number. Now let's open the file up with a hex editor, right at the start we see</p>
  <pre><code> 00000000:  00 00 00 18 66 74 79 70  6d 70 34 32 00 00 00 00  ....ftypmp42....
   00000010:  6d 70 34 32 6d 70 34 31  00 01 69 7b 6d 6f 6f 76  mp42mp41..i{moov
   00000020:  00 00 00 6c 6d 76 68 64  00 00 00 00 dd 69 a6 fb  ...lmvhd.....i..
   00000030:  dd 69 a6 fb 00 00 00 01  7f ff ff ff 00 01 00 00  .i..............
  </code></pre>
  <p>There's our culprit, right at the 0x38 mark. Let's edit it and see what happens. I actually get a funnier &quot;joke&quot; if I change 7f to ff at the start. To understand why it works, please see <a href="https://www.geeksforgeeks.org/how-the-negative-numbers-are-stored-in-memory/" rel="noreferrer">How the negative numbers are stored in memory?</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-07T01:14:44.443Z
Answers.LastActivityDate: 2021-12-07T18:14:02.690Z
Answers.LastEditDate: 2021-12-07T18:14:02.690Z
Answers.UserDisplayName: v010dya
Body: <p>I came across <a href="https://cdn.discordapp.com/attachments/642256326826786826/888362096075620362/top29quintillioncheese.mp4" rel="noreferrer">this joke mp4</a> file online. (Warning: direct download link to an 8 mb file.) Media players as well as ffmpeg both list the file as having a length of 596523:14:07.00 (!). My first guess was that the video might have used a very low frame rate, but ffmpeg lists a frame rate of 10 fps, with no frames having a variable frame rate. What is going on in the encoding of this file to give it such a long length?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-12-07T20:40:28.023Z
Comments.Text: Here is a hint: if someone tells you "I am 100m tall", do they *actually* need to be 100m tall in order to say this?
Comments.UserDisplayName: Jörg W Mittag
Tags: <encoding><mp4>
Title: How is this .mp4 file 596523 hours long?
UserDisplayName: margalo
ThreadText: # How is this .mp4 file 596523 hours long?
  
  (Asked by: username_0 on 2021-12-06)
  
  I came across [this joke mp4](https://cdn.discordapp.com/attachments/642256326826786826/888362096075620362/top29quintillioncheese.mp4) file online. (Warning: direct download link to an 8 mb file.) Media players as well as ffmpeg both list the file as having a length of 596523:14:07.00 (!). My first guess was that the video might have used a very low frame rate, but ffmpeg lists a frame rate of 10 fps, with no frames having a variable frame rate. What is going on in the encoding of this file to give it such a long length?
  
  **Tags:** encoding, mp4
  
  > **Comments:**
  > **username_1**: Here is a hint: if someone tells you "I am 100m tall", do they *actually* need to be 100m tall in order to say this?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-12-07. Score: 22 | Accepted answer
  
  There are several things we can note here:
  
  1. The file stops playing after 0:05:30.
  2. If you remux the file (mkvtools for example) you do have 5:30 displayed as the length.
  3. The original file does in fact show the ridiculous length.
  
  So, although it is a funny joke, it is not as cool as I first thought. Nobody has figured out how to do an infinite loop of frames or anything similar to that. This appears to be just a header of the file that is not matching the data.
  
  How does the player (or most tools) figure out the length of the video? They do not read the whole file, otherwise the load times of files would be impractical. So at the start of the file there is a marker that says the length, and the player just trusts it.
  
  Let's run through the maths:
  
  ```
  596523:14:07.00 = ((596523*60)+14)*60+7 = 2147483647 seconds
  2147483647 (base 10) = 7FFFFFFF (base 16)
  
  ```
  
  Oh, that's a nice number. Now let's open the file up with a hex editor, right at the start we see
  
  ```
   00000000:  00 00 00 18 66 74 79 70  6d 70 34 32 00 00 00 00  ....ftypmp42....
   00000010:  6d 70 34 32 6d 70 34 31  00 01 69 7b 6d 6f 6f 76  mp42mp41..i{moov
   00000020:  00 00 00 6c 6d 76 68 64  00 00 00 00 dd 69 a6 fb  ...lmvhd.....i..
   00000030:  dd 69 a6 fb 00 00 00 01  7f ff ff ff 00 01 00 00  .i..............
  
  ```
  
  There's our culprit, right at the 0x38 mark. Let's edit it and see what happens. I actually get a funnier "joke" if I change 7f to ff at the start. To understand why it works, please see [How the negative numbers are stored in memory?](https://www.geeksforgeeks.org/how-the-negative-numbers-are-stored-in-memory/).
  
  
  ---
  
  