tdesktop icon indicating copy to clipboard operation
tdesktop copied to clipboard

mp4 files with large headers dont stream

Open dalekot opened this issue 3 years ago • 8 comments

Steps to reproduce

Try to play back a mp4 file with a large header (>8mb it seems) and it won't stream.

For example https://t.me/moov_test has two files containing the same video. They are encoded the same except gop size was changed to get a moov atom of different size. One streams and one will buffer for a couple seconds and change to where you are forced to download it completely before you can play it back. This affects lots of long videos since the header grows along with the video, and theres no real workaround other than being forced to completely reencode with special settings to try and make the header small enough so telegram streams it.

AtomicParsley output for streamable file
Atom ftyp @ 0 of size: 32, ends @ 32
Atom moov @ 32 of size: 5128999, ends @ 5129031
   Atom mvhd @ 40 of size: 108, ends @ 148
   Atom trak @ 148 of size: 3259056, ends @ 3259204
       Atom tkhd @ 156 of size: 92, ends @ 248
       Atom edts @ 248 of size: 48, ends @ 296
           Atom elst @ 256 of size: 40, ends @ 296
       Atom mdia @ 296 of size: 3258908, ends @ 3259204
           Atom mdhd @ 304 of size: 32, ends @ 336
           Atom hdlr @ 336 of size: 45, ends @ 381
           Atom minf @ 381 of size: 3258823, ends @ 3259204
               Atom vmhd @ 389 of size: 20, ends @ 409
               Atom dinf @ 409 of size: 36, ends @ 445
                   Atom dref @ 417 of size: 28, ends @ 445
               Atom stbl @ 445 of size: 3258759, ends @ 3259204
                   Atom stsd @ 453 of size: 195, ends @ 648
                       Atom avc1 @ 469 of size: 179, ends @ 648
                           Atom avcC @ 555 of size: 57, ends @ 612
                           Atom pasp @ 612 of size: 16, ends @ 628                     ~
                   Atom stts @ 648 of size: 24, ends @ 672
                   Atom ctts @ 672 of size: 2159584, ends @ 2160256
                   Atom stss @ 2160256 of size: 232, ends @ 2160488
                   Atom stsc @ 2160488 of size: 10024, ends @ 2170512
                   Atom stsz @ 2170512 of size: 1080020, ends @ 3250532
                   Atom stco @ 3250532 of size: 8672, ends @ 3259204
   Atom trak @ 3259204 of size: 1869729, ends @ 5128933
       Atom tkhd @ 3259212 of size: 92, ends @ 3259304
       Atom edts @ 3259304 of size: 36, ends @ 3259340
           Atom elst @ 3259312 of size: 28, ends @ 3259340
       Atom mdia @ 3259340 of size: 1869593, ends @ 5128933
           Atom mdhd @ 3259348 of size: 32, ends @ 3259380
           Atom hdlr @ 3259380 of size: 45, ends @ 3259425
           Atom minf @ 3259425 of size: 1869508, ends @ 5128933
               Atom smhd @ 3259433 of size: 16, ends @ 3259449
               Atom dinf @ 3259449 of size: 36, ends @ 3259485
                   Atom dref @ 3259457 of size: 28, ends @ 3259485
               Atom stbl @ 3259485 of size: 1869448, ends @ 5128933
                   Atom stsd @ 3259493 of size: 114, ends @ 3259607
                       Atom mp4a @ 3259509 of size: 98, ends @ 3259607
                           Atom esds @ 3259545 of size: 42, ends @ 3259587
                           Atom btrt @ 3259587 of size: 20, ends @ 3259607                     ~
                   Atom stts @ 3259607 of size: 64, ends @ 3259671
                   Atom stsc @ 3259671 of size: 40, ends @ 3259711
                   Atom stsz @ 3259711 of size: 1860496, ends @ 5120207
                   Atom stco @ 5120207 of size: 8672, ends @ 5128879
                   Atom sgpd @ 5128879 of size: 26, ends @ 5128905                     ~
                   Atom sbgp @ 5128905 of size: 28, ends @ 5128933
   Atom udta @ 5128933 of size: 98, ends @ 5129031
       Atom meta @ 5128941 of size: 90, ends @ 5129031
           Atom hdlr @ 5128953 of size: 33, ends @ 5128986
           Atom ilst @ 5128986 of size: 45, ends @ 5129031
               Atom ©too @ 5128994 of size: 37, ends @ 5129031
                   Atom data @ 5129002 of size: 29, ends @ 5129031
Atom mdat @ 5129031 of size: 249986374, ends @ 255115405
Atom free @ 255115405 of size: 8, ends @ 255115413
Atom free @ 255115413 of size: 73, ends @ 255115486
AtomicParsley output for non-streamable file
Atom ftyp @ 0 of size: 32, ends @ 32
Atom moov @ 32 of size: 8951143, ends @ 8951175
   Atom mvhd @ 40 of size: 108, ends @ 148
   Atom trak @ 148 of size: 4212664, ends @ 4212812
       Atom tkhd @ 156 of size: 92, ends @ 248
       Atom edts @ 248 of size: 48, ends @ 296
           Atom elst @ 256 of size: 40, ends @ 296
       Atom mdia @ 296 of size: 4212516, ends @ 4212812
           Atom mdhd @ 304 of size: 32, ends @ 336
           Atom hdlr @ 336 of size: 45, ends @ 381
           Atom minf @ 381 of size: 4212431, ends @ 4212812
               Atom vmhd @ 389 of size: 20, ends @ 409
               Atom dinf @ 409 of size: 36, ends @ 445
                   Atom dref @ 417 of size: 28, ends @ 445
               Atom stbl @ 445 of size: 4212367, ends @ 4212812
                   Atom stsd @ 453 of size: 195, ends @ 648
                       Atom avc1 @ 469 of size: 179, ends @ 648
                           Atom avcC @ 555 of size: 57, ends @ 612
                           Atom pasp @ 612 of size: 16, ends @ 628                     ~
                   Atom stts @ 648 of size: 24, ends @ 672
                   Atom stss @ 672 of size: 108020, ends @ 108692
                   Atom ctts @ 108692 of size: 1944032, ends @ 2052724
                   Atom stsc @ 2052724 of size: 40, ends @ 2052764
                   Atom stsz @ 2052764 of size: 1080028, ends @ 3132792
                   Atom stco @ 3132792 of size: 1080020, ends @ 4212812
   Atom trak @ 4212812 of size: 4738265, ends @ 8951077
       Atom tkhd @ 4212820 of size: 92, ends @ 4212912
       Atom edts @ 4212912 of size: 36, ends @ 4212948
           Atom elst @ 4212920 of size: 28, ends @ 4212948
       Atom mdia @ 4212948 of size: 4738129, ends @ 8951077
           Atom mdhd @ 4212956 of size: 32, ends @ 4212988
           Atom hdlr @ 4212988 of size: 45, ends @ 4213033
           Atom minf @ 4213033 of size: 4738044, ends @ 8951077
               Atom smhd @ 4213041 of size: 16, ends @ 4213057
               Atom dinf @ 4213057 of size: 36, ends @ 4213093
                   Atom dref @ 4213065 of size: 28, ends @ 4213093
               Atom stbl @ 4213093 of size: 4737984, ends @ 8951077
                   Atom stsd @ 4213101 of size: 126, ends @ 4213227
                       Atom mp4a @ 4213117 of size: 110, ends @ 4213227
                           Atom esds @ 4213153 of size: 54, ends @ 4213207
                           Atom btrt @ 4213207 of size: 20, ends @ 4213227                     ~
                   Atom stts @ 4213227 of size: 64, ends @ 4213291
                   Atom stsc @ 4213291 of size: 1797220, ends @ 6010511
                   Atom stsz @ 6010511 of size: 1860492, ends @ 7871003
                   Atom stco @ 7871003 of size: 1080020, ends @ 8951023
                   Atom sgpd @ 8951023 of size: 26, ends @ 8951049                     ~
                   Atom sbgp @ 8951049 of size: 28, ends @ 8951077
   Atom udta @ 8951077 of size: 98, ends @ 8951175
       Atom meta @ 8951085 of size: 90, ends @ 8951175
           Atom hdlr @ 8951097 of size: 33, ends @ 8951130
           Atom ilst @ 8951130 of size: 45, ends @ 8951175
               Atom ©too @ 8951138 of size: 37, ends @ 8951175
                   Atom data @ 8951146 of size: 29, ends @ 8951175
Atom free @ 8951175 of size: 8, ends @ 8951183
Atom mdat @ 8951183 of size: 578061859, ends @ 587013042

Expected behaviour

Both files should stream in telegram without having to be downloaded first

Actual behaviour

The file with a large header doesnt stream

Operating system

windows 10 pro 20h2

Version of Telegram Desktop

4.0.2

Installation source

Static binary from official website

Logs

No response

dalekot avatar Jul 24 '22 21:07 dalekot

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

github-actions[bot] avatar Jan 21 '23 01:01 github-actions[bot]

Still a problem.

soredake avatar Jan 22 '23 14:01 soredake

For some reason 64gram does not have this problem.

soredake avatar Apr 11 '23 14:04 soredake

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

github-actions[bot] avatar Oct 09 '23 01:10 github-actions[bot]

Not stale.

soredake avatar Oct 12 '23 09:10 soredake

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

github-actions[bot] avatar Apr 11 '24 01:04 github-actions[bot]

Nothing changed.

soredake avatar Apr 11 '24 06:04 soredake

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

github-actions[bot] avatar Oct 09 '24 01:10 github-actions[bot]

Bump.

reallyuniquename avatar Nov 10 '24 19:11 reallyuniquename

yeah, sorry, streaming player currently can't support streaming of video with larger-than-8mb header size.

john-preston avatar Nov 11 '24 14:11 john-preston

TDesktop tries to start playback of the file, but if it's forced to download more than 8 mb to even get the first frame, it is considered non-streamable.

john-preston avatar Nov 11 '24 14:11 john-preston