Reply To: iTunes internals

#14970
Anonymous
Inactive

@rpedde wrote:

-T I think shows the metadata tree. You’re checking if the mdat atom is at the end, not at the beginning.

Creating a file like this:

ffmpeg -i Filename_avi-avi.avi -vcodec mpeg4 -bufsize 65536 -maxrate 1000k -b 716800 -qmin 3 -qmax 5 -g 300 -s 320x240 -aspect 4:3 -acodec libfaac -ar 44100 -ab 128k -async 1 -f mp4 "Filename_mp4-mp4 (SpecOpts).mp4"

will give the following output from AtomicParsley -T

Atom ftyp @ 0 of size: 20, ends @ 20
Atom free @ 20 of size: 8, ends @ 28
Atom mdat @ 28 of size: 373402548, ends @ 373402576
Atom moov @ 373402576 of size: 3381993, ends @ 376784569
Atom mvhd @ 373402584 of size: 108, ends @ 373402692
Atom trak @ 373402692 of size: 1245557, ends @ 374648249
Atom tkhd @ 373402700 of size: 92, ends @ 373402792
Atom mdia @ 373402792 of size: 1245457, ends @ 374648249
Atom mdhd @ 373402800 of size: 32, ends @ 373402832
Atom hdlr @ 373402832 of size: 45, ends @ 373402877
Atom minf @ 373402877 of size: 1245372, ends @ 374648249
Atom vmhd @ 373402885 of size: 20, ends @ 373402905
Atom dinf @ 373402905 of size: 36, ends @ 373402941
Atom dref @ 373402913 of size: 28, ends @ 373402941
Atom stbl @ 373402941 of size: 1245308, ends @ 374648249
Atom stsd @ 373402949 of size: 184, ends @ 373403133
Atom mp4v @ 373402965 of size: 168, ends @ 373403133
Atom esds @ 373403051 of size: 82, ends @ 373403133
Atom stts @ 373403133 of size: 24, ends @ 373403157
Atom stss @ 373403157 of size: 5132, ends @ 373408289
Atom stsc @ 373408289 of size: 28, ends @ 373408317
Atom stsz @ 373408317 of size: 619968, ends @ 374028285
Atom stco @ 374028285 of size: 619964, ends @ 374648249
Atom trak @ 374648249 of size: 2136320, ends @ 376784569
Atom tkhd @ 374648257 of size: 92, ends @ 374648349
Atom mdia @ 374648349 of size: 2136220, ends @ 376784569
Atom mdhd @ 374648357 of size: 32, ends @ 374648389
Atom hdlr @ 374648389 of size: 45, ends @ 374648434
Atom minf @ 374648434 of size: 2136135, ends @ 376784569
Atom smhd @ 374648442 of size: 16, ends @ 374648458
Atom dinf @ 374648458 of size: 36, ends @ 374648494
Atom dref @ 374648466 of size: 28, ends @ 374648494
Atom stbl @ 374648494 of size: 2136075, ends @ 376784569
Atom stsd @ 374648502 of size: 91, ends @ 374648593
Atom mp4a @ 374648518 of size: 75, ends @ 374648593
Atom esds @ 374648554 of size: 39, ends @ 374648593
Atom stts @ 374648593 of size: 24, ends @ 374648617
Atom stsc @ 374648617 of size: 28, ends @ 374648645
Atom stsz @ 374648645 of size: 1067964, ends @ 375716609
Atom stco @ 375716609 of size: 1067960, ends @ 376784569
Total size: 376784569 bytes; 39 atoms total. AtomicParsley version: 0.9.0 (utf8)
Media data: 373402548 bytes; 3382021 bytes all other atoms (0.898% atom overhead).
Total free atom space: 8 bytes; 0.000% waste.

So if I understand you correct about the mdat atom, this file should be streamable… Correct?
It’s playable through the FS any way.
@rpedde wrote:

@turbo wrote:

The changed testing phase is to set mp4v files to be SSC transcoded, make sure the script simply cat’s the file to STDOUT. This works when clicking on the actual file I want streamed.. But if clicking the AVI file (still cat’ing the streamable – working – MPEG4IP converted/fixed file though!) will (still!) make iTunes to hang up.. This is how I’ve been testing this previously, so apparently iTunes notices that it isn’t getting the file requested… ?!?

probably from a different codec type.

different codec type? How do you mean?

I’ve faked the codec type in the DB so that the AVI looks like an MP4 – update songs set codectype=’mp4v’,type=’m4v’ where path like ‘%.avi’ and patch FireFly to send the codectype as Content-Type. Also tried codectype=’mp4a’,type=’m4a’ which would lead to Content-Type: audio/m4a (which is the same Content-Type as streaming the Filename_mp4-mp4 (SpecOpts).mp4 file) to no avail.

But it even though the file is supposed to be streamable (the mdat atom at the beginning and all), it still don’t stream..

Session 0: Transcoding file 'Filename_avi-avi.avi' to 192.168.1.1 (offset 0)
Transcoding /share/Movies/tmp/Filename_avi-avi.avi with ssc-script/0.2.1.1 (codectype=mp4v)
Executing /usr/local/bin/mt-daapd-ssc.pl "/share/Movies/tmp/Filename_avi-avi.avi" 0 600.000 "mp4v"
Updating Content-Type from application/x-dmap-tagged to audio/m4v
Updating Connection from close to Close
Emitting reponse header Expires: -1
Emitting reponse header Cache-Control: no-cache
Emitting reponse header DAAP-Server: firefly/0.2.1.1
Emitting reponse header Accept-Ranges: bytes
Emitting reponse header Content-Language: en_us
Emitting reponse header Content-Type: audio/m4v
Emitting reponse header Server: mt-daapd/0.2.1.1
Emitting reponse header Connection: Close
Emitting reponse header Date: Sat, 22 Dec 2007 14:02:13 GMT
DEBUG: Streaming symlink '/share/Movies/tmp/Filename_mp4-mp4 (SpecOpts).mp4'
DEBUG: Transcoding started (pid=)...
DEBUG: Waiting for stream...
DEBUG: Starting to stream from '/tmp/t-20193'.
DEBUG: 1(4096) 2(4096) 3(4096) 4(4096) 5(4096) 6(4096) 7(4096) 8(4096) 9(4096) 10(4096) 11(4096) 12(4096) 13(4096) 14(4096) 15(4096) 16(4096) 17(4096) 18(4096) 19(4096) 20(4096) 21(4096) 22(4096) 23(4096) 24(4096) 25(4096) 26(4096) 27(4096) 28(4096) 29(4096) 30(4096) 31(4096) 32(4096) Error writing to client socket: Broken pipe
ERROR: Buffer write failed ('' != '4096'): Broken pipe

id          path                                    type        codectype   has_video





2 /share/Movies/tmp/Filename_avi-avi.avi m4v mp4v 1
15 /share/Movies/tmp/Filename_mp4-mp4 (Sp m4a mp4a 0

So… As I understand it, it should stream!

Clicking on the id=15 file, iTunes will stream. The sound anyway (because of the type=m4a). So changing the id=2 file to have the same values (including has_video, description etc) as id=15, iTunes should play the sound at least, right?

Well, it doesn’t…

@rpedde wrote:

@turbo wrote:

What’s going on here!?

Nary a clue. But as mentioned before, you aren’t going to get this work with simple shell scripts. You’re going to *have* to have something to synthesize headers, like wavstreamer does only with m4v.

Tripple checking that the Filename_mp4-mp4 (SpecOpts).mp4 is actually streamable through the perlscript, I simply link that file to the temp file the script uses and click the filename in iTunes (I’ve also set mp4a to always transcode). And as expected, it works (sound anyway, but that was expected). I can see the script being invoced and ‘link’ being streamed.

@rpedde wrote:

Also, I’m not sure you are going to be able to stream anything but m4v (or something transcoded to m4v), since most of the quicktime plugins require seekable streams.

Fair enough. QuickTime is a quite sucky format any way. But I didn’t have much more luck with MP4…
@rpedde wrote:

The only think I *know* will stream with quicktime is m4v.

FireFly have now started to crash when it starts to stream the file. Don’t know if this is because the changes to the DB, FireFly or something else… I’ll try to figure out why. With a little luck I can get it to stream MP4’s as soon as I figure out why it’s crashing…