Page 1 of 6 123 ... LastLast
Results 1 to 15 of 80

Thread: S1 -> S2: Analyzing the audio problem...

  1. #1
    Join Date
    Jan 2002
    Location
    Sonoran Desert
    Posts
    2,823

    S1 -> S2: Analyzing the audio problem...

    I had some spare time today, so I recorded some sample audio only (easiest to compare) tystreams from an S1 and an S2 and did some playing around with them.

    I am not much of an mpeg expert, but I took a peek peeked at the stream with a hex editor. The first thing I really noticed is that on S2 audio only streams, the master chunk is all but blank. All it contains is the regular tystream part header to indicate chunk sizes, part size, etc. The S1 stream has that, plus its loaded with crap that means nothing to me.

    So far as the chunk records go, everything is pretty much as you'd expect (nothing but 3C0 headers, or MPEG Layer 2 audio, except in the S1 streams, where the record always begins with a 2C0 header.)

    I was hoping to see an obvious change that would be necessary to make these streams compatible with S2 units, but its obviously way beyond me.

    This one is definitely for our tystream experts to look at, so, I have made some sample streams available here. (it's only a 5 meg file) The S1 stream wa recorded from 3.1.0b, and the S2 stream was recorded from 3.1.1b.
    Last edited by AlphaWolf; 02-06-2004 at 04:22 PM.
    Before PMing me: Iím not your personal tech support. If you have a question, ask in public so I don't have to repeat if somebody else asks. If you want images or slices, use emule. I will ignore all support PMs.

    Sponsor a vegetarian! I have taken the pledge, how about you?

  2. #2
    Join Date
    Feb 2002
    Posts
    6,414
    I've been playing around with mfs_ftp lately and one of the things I've been trying to do is transfer some shows from my S1 DTivo to my S2 DTivos. Aside from some scrambling issues (noscramble.o on the S1 vs. tivoapp patches on the S2's; csoscout.tcl fixed some of them) the transferred shows that eventually played back on the S2 units had no sound. The video was fine but they were dead quiet. The strange thing is that when I attempted to play them back while still in the process of being transferred, they played back with no scrambling issues and with full sound. The scrambling and audio problems didn't occur until the transfer was completed. How's that for weird?
    Please don't PM me or any other members looking for personal assistance. You'll do better by posting (after you've exhausted the search feature, of course) and taking advantage of the collective expertise of the membership instead of a single individual that may or may not be able to help you. Thank you and enjoy your stay at DDB!

  3. #3
    Join Date
    Jan 2002
    Location
    Sonoran Desert
    Posts
    2,823
    There are two possible explanations for this.

    One explanation would be that what you thought was your inserted stream really wasn't, and instead it was the remains of a stream that was previously recorded in that exact location of your tivos hard disk. When you use mfs streamcreate to produce a blank tystream (and subsequently fill it) this can easily happen, and your audio would work while your tivo was playing that.

    Another explanation would be that the S2 dtivos really are fully compatible with S1 streams, only theres an attribute in MFS which when set breaks this compatibility when the stream plays. I am currently investigating this possibility...

    EDIT: tried a bunch of settings and nothing worked. It's probable that your tivo was playing something other than the actual stream you tried to insert.

    EDIT 2: Yep, just confirmed that is the cause. I started an insert of an S1 stream, and right after the insertion began, I tried to play the stream, it played the first bits of video, but then after that ran out, the timeshift arrow moved to the very end of the bar, and started playing audio from some other previously existing tystream.
    Last edited by AlphaWolf; 02-06-2004 at 08:39 PM.
    Before PMing me: Iím not your personal tech support. If you have a question, ask in public so I don't have to repeat if somebody else asks. If you want images or slices, use emule. I will ignore all support PMs.

    Sponsor a vegetarian! I have taken the pledge, how about you?

  4. #4
    Join Date
    Feb 2002
    Posts
    6,414
    Interesting. I didn't try playing the entire clip as only the first FSID was still in the process of transfer [the progress bar indicated a full one-hour length for the video but was indicating a partial recording of about 30 minutes (green bar indicating the actual recording) for a tmf file of 1.09GB]. The audio definitely matched the clip I was transferring because the voices were in perfect sync. This happened twice with the same clip.

    The first time I hadn't deleted the *.xml files from the cache directory so I deleted the files and the cache and transferred them again from scratch after a reboot of each DTivo with the exact same results. I only tried the audio at the beginning of the clip and it played both times, but only while the transfer was in progress. When it completed the video wouldn't play at all. A quick run of ciphercheck.tcl indicated the CSOs were still set (i.e. a No in the 1st column and a Yes in the 2nd) for the clips I transferred. Oddly, one of the three clips still refused to play after running csoscout.tcl. None of the clips had any audio after nuking the CSOs.
    Please don't PM me or any other members looking for personal assistance. You'll do better by posting (after you've exhausted the search feature, of course) and taking advantage of the collective expertise of the membership instead of a single individual that may or may not be able to help you. Thank you and enjoy your stay at DDB!

  5. #5
    Join Date
    Jan 2002
    Posts
    4,809
    Ok. There are number of crucial differences in the formats of the 2 types, S1 vs. S2. I have to deal with them when splitting and what not.

    Without a clear picture of what it is you are trying to do I am not sure what you know or looking to find out.

    But if you can fill me in a bit I would be happy to explain what I have figured out between the 2 formats. The nice thing is that the differences at the level I deal with them on are subtle yet are all packagaing of the data. I.e. no specific data changes between the 2 formats.

    --jdiner

  6. #6
    Join Date
    Jan 2002
    Location
    Sonoran Desert
    Posts
    2,823
    The goal here is to get S1 dtivo streams (non AC3) to play in an S2 dtivo. The video plays alright, but there is no audio at all. S2 streams play fine on an S1 dtivo however.
    Last edited by AlphaWolf; 02-06-2004 at 10:49 PM.
    Before PMing me: Iím not your personal tech support. If you have a question, ask in public so I don't have to repeat if somebody else asks. If you want images or slices, use emule. I will ignore all support PMs.

    Sponsor a vegetarian! I have taken the pledge, how about you?

  7. #7
    Join Date
    Dec 2002
    Posts
    43
    Quote Originally Posted by AlphaWolf
    The goal here is to get S1 dtivo streams (non AC3) to play in an S2 dtivo. The video plays alright, but there is no audio at all. S2 streams play fine on an S1 dtivo however.
    Non-AC3? Does that mean that AC3 streams will play? (Also, if its really an issue with the mfs info being set after the insert completes, would it be fixable in the future - ie insert stuff now, and later alter mfs to whatever the 'correct' info is..)

    Tomorrow is my big s1->s2 dtivo conversion, so I'll experiment a bit and get back to you. (But I'm not a tcl or mfs guy so any guidance/specific tests/etc would be very welcome..)

  8. #8
    Join Date
    Dec 2002
    Posts
    43

    Update

    So far, I've got a 2.0-analog/2.0-digital/5.1 digital stream that plays fine and a standard stream that doesn't.

    Tested:
    - Show off HBO (Starts at analog 2.0, then digital 2.0, then digital 5.1)
    * Played fine during insert, still plays fine
    * analog/2.0/5.1 all output correctly on digital out
    - Generic stream (cartoon)
    * There is no sound on analog or digital - digital out says pcm/48000 but doesn't make a peep

    I'm going to extract something (analogish) recorded on it and see what I can find out, but I'm not an mpeg guy so suggestions are greatly welcome..

    Also, I can confirm that it is possible during insert to 'jump' into old data that hasn't been overwritten yet.
    Last edited by Disconnect; 04-04-2004 at 07:20 PM. Reason: update testing

  9. #9
    Join Date
    Jul 2003
    Location
    NYC
    Posts
    339
    isn't this thread a good candidate for the development forum, as it is analysis for a future fix and not really mfs_ftp support

    [edit] that was fast
    Last edited by AVD; 04-06-2004 at 07:08 PM.

  10. #10
    Join Date
    Dec 2002
    Posts
    43

    W00t!

    OK. Shut down tivoapp, catted the mp2 to /dev/mp2 and it played. So the hardware is more than capable of playing the s1 stereo streams. Bonus, it also played (both analog and digital) when catted to /dev/ac3. So if we can convince tivoapp that these streams are ac3, it should Just Work.

    So...umm... anyone know how to do that?

  11. #11
    Join Date
    Jan 2002
    Posts
    1,778
    VALID audio data from a D2 stream, seen at /dev/mpeg0a on a D2:

    aud_write 00 00 01 c0 02 4a 80 80 07 21 04 13 f0 f5 ff ff ff fd a4 64 66 33
    33 44 55 44 55 55 44 44 54 6d ...

    aud_write 00 00 01 c0 02 4a 80 80 07 21 04 15 01 d5 ff ff ff fd a4 64 55 22
    22 44 55 44 44 55 55 55 44 b1 ...

    aud_write 00 00 01 c0 02 4a 80 80 07 21 04 15 12 b5 ff ff ff fd a4 64 66 33
    33 33 44 44 34 44 44 34 34 92 ...

    aud_write 00 00 01 c0 02 4a 80 80 07 21 04 15 23 95 ff ff ff fd a4 64 77 33
    33 33 43 33 43 43 43 43 43 92 ...

    SILENT audio data inserted from a D1, as seen at /dev/mpeg0a on a D2:

    aud_write 00 00 00 01 c0 02 45 21 02 f1 49 cf ff fd a4 64 66 44 44 66 56 55
    45 34 34 22 11 6d b2 49 00 00 ...

    aud_write 00 00 00 00 01 c0 02 45 21 02 f3 cd ef ff fd a4 64 66 33 33 66 67
    66 56 55 34 23 22 48 92 48 00 ...

    aud_write 00 00 00 01 c0 02 45 21 02 f3 de cf ff fd a4 64 66 33 33 66 66 66
    66 66 34 33 22 28 92 49 00 00 ...

    aud_write 00 00 01 c0 02 45 21 02 f3 ef af ff fd a4 64 56 33 33 66 77 77 66
    56 33 34 22 24 92 48 00 00 01 ...

    Removing the padding looks tempting, but I tried it and it didn't work. It may or may not be necessary, but it's definitely not sufficient. The next step would be to parse this data and figure out what other differences exist.

  12. #12
    Join Date
    Jan 2002
    Location
    Sonoran Desert
    Posts
    2,823
    Quote Originally Posted by Disconnect
    OK. Shut down tivoapp, catted the mp2 to /dev/mp2 and it played. So the hardware is more than capable of playing the s1 stereo streams. Bonus, it also played (both analog and digital) when catted to /dev/ac3. So if we can convince tivoapp that these streams are ac3, it should Just Work.

    So...umm... anyone know how to do that?
    *shrug* change the PES start header from either 3C0 (mpeg audio layer 1) or 4C0 (mpeg audio layer 2) to 9C0 (AC3 audio)?
    Before PMing me: Iím not your personal tech support. If you have a question, ask in public so I don't have to repeat if somebody else asks. If you want images or slices, use emule. I will ignore all support PMs.

    Sponsor a vegetarian! I have taken the pledge, how about you?

  13. #13
    Join Date
    Dec 2002
    Posts
    43
    Well yeah...

    But I'm having issues getting it to parse on x86 (not 110% certain I'm reading it properly either.) Next step is to pull out the mplayer-tivo parser and see if I did a stupid.

    In theory, if I get time (hopefully later this week) I'll set up a convert-audio that will just stream the ty from one file to another, converting audio tags along the way.

    The better fix is still to patch tivoapp, but....

  14. #14
    Join Date
    Jan 2002
    Posts
    1,778
    I wrote some code that modernizes the MPEG-1 PES header found on D2 MPEG-2 streams:

    Code:
    int
    write_audio(int fd, uint8_t *buf, size_t count)
    {
    	int d, c, ret;
    	uint8_t buf2[BUFSIZE];
    	uint16_t pes_header_size;
    
    	if((count > (BUFSIZE - 3)) || (count < 12))
    		return(mywrite(fd, buf, count));
    
    	d = -1;
    	for(c = 0 ; c < 8 ; ++c)
    	{
    		if((buf[c] == 0x00) &&
    		   (buf[c + 1] == 0x00) &&
    		   (buf[c + 2] == 0x01) &&
    		   ((buf[c + 3] & 0xc0) == 0xc0))
    		{
    			d = c;
    			break;
    		}
    	}
    
    	if(d == -1)
    		return(mywrite(fd, buf, count));
    
    	/* 0x21 means we're missing the PES header flags (broken S1 stream) */
    	if((buf[d + 6] & 0x21) != 0x21)
    		return(mywrite(fd, buf, count));
    
    	pes_header_size = buf[d + 5] | (buf[d + 4] << 8);
    
    	pes_header_size += 3;
    	memcpy(buf2, &buf[d], 4);	/* prefix code: 00 00 01
    					 * stream id: c0 */
    
    	buf2[4] = pes_header_size >> 8;	/* 2 bytes: pkt size */
    	buf2[5] = pes_header_size & 0xff;
    					/* flags: 80 80
    					 * remaining hdr len: 05
    					 */
    	buf2[6] = 0x84; buf2[7] = 0x80; buf2[8] = 0x05;
    
    					/* 5 bytes: PTS timestamp */
    	memcpy(&buf2[9], &buf[d + 6], 5);
    
    					/* PES packet data follows */
    	memcpy(&buf2[14], &buf[11 + d], count - 11 - d);
    
    	fprintf(stderr, "real_write ");
    	for(c = 0 ; c < 20 ; ++c)
    	{
    		fprintf(stderr, "%02x ", (int)(unsigned char)buf2[c]);
    	}
    	fprintf(stderr, "\n");
    
    	ret = mywrite(fd, buf2, count + 3 - d);
    	if(ret > 0)
    		ret = count;
    	return(ret);
    }
    By intercepting myworld's writes to mpeg0a and rewriting the PES header prior to output, I was able to get sound from inserted D1 streams which were previously silent. However, the audio is either very fast or partially cut off - I only hear pieces of it every few seconds. Those pieces seem to be at least somewhat in sync with the video when they start.

    Possibilities include:

    - wrong bitrate
    - other missing/broken parameters elsewhere in the tystream
    - I'm adding a PES header that is not appropriate for the payload?
    - buggy code
    - something to do with syncing up the video?

    Furthermore I have not gotten vplay to play audio reliably on the D2. I've logged a few ioctls that myworld uses to initialize the device, but most of the time I just get silence:

    Code:
    at startup (only?):
    
    aud_ioctl: 00000456 10102844
    aud_ioctl: 000003f0 00000000
    aud_ioctl: 000007eb 00000001
    
    
    aud_ioctl: 000007eb 00000000
    aud_ioctl: 00000461 7d1ff8b0 00 00 00 00 00 00 00 01 ff ff ff ff 00 00 00 02 00 00 00 00 00 00 00 41 00 00 00 00 00 00 00 00
    aud_ioctl: 000003ef 00000000
    aud_ioctl: 00000426 00000000
    
    prior to playing audio stream:
    
    aud_ioctl: 000007eb 00000001
    aud_ioctl: 000003f0 0000942c
    aud_ioctl: 000007eb 00000000
    aud_ioctl: 000003ef 00000000
    
    on occasion, during streams:
    
    aud_ioctl: 00001f46 7d1ff8e8 10 08 2c f0 00 00 00 0b 10 10 27 10 7d 1f f9 88 10 08 2c f0 01 34 ce 58 10 08 2c f0 10 08 2c f0
    It's possible that a mixer or some other integrated device needs to be dealt with to properly play sound. I have not looked into this yet. Having a working vplay binary would speed up the testing cycle, as rebooting the box takes several minutes.

    Can anyone shed any light on either of these issues?

    Many of those ioctls are not documented in (cwingert's?) osdtxt.c, and may be new in the Series 2.

  15. #15
    Join Date
    Feb 2002
    Posts
    20
    Has anyone tried yet or know if upgrading a S1, to the latest Tivo Software version, will get the audio to play with the video when shows are transfered to a S2 Tivo?

    My DSR6000 is still at 2.5.2. I'm going to try installing xtreme upgrade 3.1.0 on a spare HD and throwing it in the DSR6000. I'll let it record a little bit and try transfering that to my new DSR704. If that still doesn't work, I'm debating pluggin in the DSR6000 to the phone and try to get it to update to the latest version it will pull.

    (Doing that just brings up more questions in my mind though. Is that okay to do? Will the tivo people come and get me for having hacks on the unit? I'm guessing that even if it does update, it'll probably break some of the hacks.)

    So, in the hopes of saving me a bunch of time that I really don't have anyways... Does someone know if a newwer tivo OS on a S1 will make any difference?

    I'd really like to transfer off a bunch of the shows onto my new tivo. Also, I was hoping to be able to do the streaming from one tivo to the other... Guess I might have to pick up another DSR704 for $99 if no one can figure this out... =\

    Thank you guys a TON!
    With out all your hacks and mods, tinkering with my tivo wouldn't be as fun...

    Smoke_007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •