Log in

View Full Version : New HD Format - AVCHD (By Sony and Panasonic)


Pages : 1 [2] 3

bond
29th August 2006, 18:45
making people think they invented a new format? and then charge for that new format?

guada2
29th August 2006, 19:31
m2ts is yet again a new pseudo format from sony. it seems to be very similar to .ts, but something is wrong with the headers

:thanks:

guada2
29th August 2006, 22:01
2 other questions:

- With the arrival of the AVCHD, can one say that the HDV is an intermediate solution?
- ( The market of the camcorders would be it in crisis? )

Thanks.

SeeMoreDigital
29th August 2006, 22:29
I don't think so..... MPEG-2 will be a popular format for many years to come, especially as it's roots are firmly embedded in the business/professional sector

In many respects the use of "DV Tape" in high-def MPEG-2 and MPEG-4 AVC camcorders could be considered as an intermediate solution....

drmpeg
30th August 2006, 01:52
The .m2ts files appear to be captured over 1394 incorrectly, as the 1394 timestamp is present before each 188 byte packet. If the tool or demuxer can't handle 192 byte packets, it will have problems.

Otherwise, the stream is just a normal Transport Stream with H.264 video. The first stream "ezhqp1.m2ts" contains H.264 video that is field only, no MBAFF.

Ron

drmpeg
30th August 2006, 08:19
Here's the properly demuxed elementary streams:

http://www.w6rz.net/ezhqp1.264
http://www.w6rz.net/ezhqp2.264
http://www.w6rz.net/ezsm02.264
http://www.w6rz.net/ezsm03.264

Ron

SeeMoreDigital
30th August 2006, 09:03
Hi Ron,

I've got to ask.... How did you manage to de-mux the AVC streams?


Cheers

drmpeg
30th August 2006, 09:13
I just modified my xport demuxer tool. The normal 188 byte version is here:

http://www.w6rz.net/xport.zip

It will demux 188 byte Transport Streams with H.264 video. For H.264 video, it does not perform bitstream cutting to the first I-frame and first audio frame associated with that I-frame like it does with MPEG-2 video. I'd like to add the feature, but not enough time these days.

BTW, I was wrong on my previous post. The 192 byte packets are not 1394 packets, they are Blu-ray HDMV packets. This became obvious when I tried to demux the audio. Instead of the AC-3 stream being on stream_id 0xbd, it's on 0xfd. Also, there are specific Blu-ray HDMV descriptors in the stream. In fact, one of them spells out "HDMV" in ASCII.

The PID's also follow the HDMV specification:

0x0 = PAT
0x100 = PMT
0x1001 = PCR
0x1011 = video
0x1100 = audio
0x1200 = Presentation Graphics

There is a "Presentation Graphics" stream in these clips.

UPDATE: the modified version for HDMV streams is here:

http://www.w6rz.net/xporthdmv.zip

Ron

Hi Ron,

I've got to ask.... How did you manage to de-mux the AVC streams?


Cheers

bond
30th August 2006, 19:06
Here's the properly demuxed elementary streams:

http://www.w6rz.net/ezhqp1.264
http://www.w6rz.net/ezhqp2.264
http://www.w6rz.net/ezsm02.264
http://www.w6rz.net/ezsm03.264

Ronthose are not correct raw avc streams. there is something wrong with the headers the same way as they are wrong when demuxing with other tools

try to run h264_parse from mpeg4ip over them

drmpeg
30th August 2006, 22:33
They work fine with my in-house (LSI Logic/VideoLocus) bitstream analyzer. However, I'll try h264_parse.

Ron

guada2
30th August 2006, 22:41
those are not correct raw avc streams. there is something wrong with the headers the same way as they are wrong when demuxing with other tools

Yes.

drmpeg,
I saw your post:
http://forum.doom9.org/showthread.php?t=114679
Very interesting....

but say to me, where did you find these working tools. ;)
Do you know other method to demux .m2ts ?


To soon.

Sergey A. Sablin
31st August 2006, 07:49
Do you know other method to demux .m2ts ?
To soon.
Demuxer used inside Elecard player could do this without a problem - http://www.elecard.com/products/products-pc/consumer/mpeg-player/

SeeMoreDigital
31st August 2006, 09:41
Elecard's AVC DSdec v1.0.27 Build 60705 (2006-07-12) with Haali can also decode Ron's elementary streams muxed into MP4 using YAMB

guada2
31st August 2006, 20:15
"SAS" & "SMD"

:thanks:

SeeMoreDigital
31st August 2006, 20:20
I neglected to mention...

Elecard's AVC DSdec v1.0.27 Build 60705 (2006-07-12) can also decode the original .M2TS sources, using MediaPlayer Classics internal .TS splitter ;)

SeeMoreDigital
3rd September 2006, 20:24
I'm hopeless with commandline tools. Can anybody make a GUI?


Cheers

max-pain
22nd September 2006, 16:12
New videos:

http://www.watch.impress.co.jp/av/docs/20060920/ezsm.m2ts

15Mbps
http://www.watch.impress.co.jp/av/docs/20060920/ezxp.m2ts

9Mbps
http://www.watch.impress.co.jp/av/docs/20060920/ezhq.m2ts

7Mbps
http://www.watch.impress.co.jp/av/docs/20060920/ezsp.m2ts

5Mbps
http://www.watch.impress.co.jp/av/docs/20060920/ezlp.m2ts

bond
14th October 2006, 20:19
looking at this (http://www.blu-raydisc.com/assets/downloadablefile/5th_japan_04-13342.pdf) on page 21, it seems .m2ts is the extension for the video streams on bluraydiscs, so propably this sony cam tries to create bluray compliant files

SeeMoreDigital
14th October 2006, 20:51
That would seem logical ;)

posdnya
15th October 2006, 09:22
it seems .m2ts is the extension for the video streams on bluraydiscs, so propably this sony cam tries to create bluray compliant files

.M2TS is usual exetension for MPEG2 Transport Stream files. MPEG2 Transport Stream is used in Blue-Ray, HD DVD, DVB S2, DVB T/C/S, in other models of Sony cams with MPEG2 Video both SD and HD resolutions, and in many more cases.

bond
15th October 2006, 09:59
hddvd afaik uses program streams

drmpeg
16th October 2006, 11:28
hddvd afaik uses program streams
That's correct. It should also be noted that .m2ts files are for Blu-ray and AVCHD only.

The typical Transport Stream used in broadcast (ATSC, DVB-T,S,C, cable QAM and others) is a constant rate bitstream. However, the .m2ts format is intended for storage on blue or red laser optical discs.

It would be a waste of space to use a constant rate Transport Stream, so a variable rate Transport Stream is used instead. In order for the PCR (and clock recovery) to make sense, a 4-byte timestamp that represents arrival time is added to each 188-byte packet.

The timestamp allows playback that can reconstruct a constant rate (and T-STD compliant) Transport Stream from a variable rate stored bitstream.

Ron

guada 2
16th October 2006, 13:01
drmpeg,

then Blu-ray would uses .m2ts in VTS?
If i choose a day to use "CTS" mode, could you say me the space that i would take with a movie 90min?

diogen
16th October 2006, 19:26
It should also be noted that .m2ts files are for Blu-ray and AVCHD only.Ron,
Given that each blue laser camp uses its own - and different - format: program and transport stream, do you find any of them preferrable for the task at hand: reliability, security, encoding, etc.

Does HD-DVD use "standard" program streams?
What could be BD's reasoning for coming up with a new VBR trasport stream?

Thanks.
Diogen.

Trahald
16th October 2006, 19:48
you should look at the directory of a bluray disk and the directory of a hddvd disk. the hddvd directory (HVDVD_TS) is just the video_ts structure with different filenames. (ifo, bup and evo(vob)) the ifo files are even still stamped with text of the type (hd-dvdvmg100 or standard-vts) at the beginning like dvd ifos. the vobs(evos) and ifo internally are similar as well. vobedit can read a .evo (although it interprets most of the data wrong.. it gets some of it is right)

blu-ray disks carry a completely different structure. hddvd was built on top of dvd. blu ray was built from scratch (as a disc format i should say)

drmpeg
16th October 2006, 23:14
Ron,
Given that each blue laser camp uses its own - and different - format: program and transport stream, do you find any of them preferrable for the task at hand: reliability, security, encoding, etc.

Does HD-DVD use "standard" program streams?
What could be BD's reasoning for coming up with a new VBR trasport stream?

Thanks.
Diogen.
Yes, HD-DVD .evo files are exactly like SD DVD .vob files. They are standard MPEG-2 program streams with an additional audio stream id in the audio PES.

The choice of TS for Blu-ray is about recording. It's easy to make a .m2ts file on the fly. Just discard stuffing packets and add the arrival time timestamps before you store to optical or hard disk.

Ron

pstdenis
22nd October 2006, 02:36
How do I use xport to demux the ac3 audio? The readme says to use the -d but I can't get that to work.

drmpeg
22nd October 2006, 05:58
How do I use xport to demux the ac3 audio? The readme says to use the -d but I can't get that to work.
Sorry, it's a mistake in the readme. It is supposed to say the -n option.

For example:

xporthdmv -n ezsm.m2ts 1 1 1

The -d option dumps the PID for each packet.

Ron

pstdenis
22nd October 2006, 21:13
Thanks Ron, that worked! I don't know if anyone can help with the next question I have. I am trying to get a workflow on OS X to convert it into something usable by Final Cut, your tool compiles and works without a problem, but I haven't found anything that will decode the CABAC interlaced video. Has anyone been able to play or convert the demuxed elementary streams using linux tools?

bond
22nd October 2006, 21:47
every time i demux the avc stream to raw, the raw stream seems to be borked

drmpeg
23rd October 2006, 11:09
every time i demux the avc stream to raw, the raw stream seems to be borked
The reference decoder has no problems with these streams.

http://www.watch.impress.co.jp/av/docs/20060920/ezxp.m2ts

http://www.w6rz.net/xporthdmv.zip

http://www.w6rz.net/jmfrextdecoder.zip

xporthdmv -n ezxp.m2ts 1 1 1

ldecod -i bits0001.mpv -o decode.yuv

decode.yuv is planer 4:2:0.

http://img223.imageshack.us/img223/4964/avchdlz0.jpg (http://imageshack.us)

Ron

bond
23rd October 2006, 19:10
still h264_parse from mpeg4ip isnt able to show all the nals, therefore i think there is something borked with the streams

drmpeg
23rd October 2006, 22:37
still h264_parse from mpeg4ip isnt able to show all the nals, therefore i think there is something borked with the streams
Isn't it possible that h264_parse is what is actually "borked"?

Ron

bond
23rd October 2006, 23:17
Isn't it possible that h264_parse is what is actually "borked"?

Ronit works perfectly on all files except those sony samples

pstdenis
24th October 2006, 04:12
Thanks for your help Ron!
Using your tool, the H.264/AVC Reference Software available here
http://iphome.hhi.de/suehring/tml/download/ (jm11.0.zip was the latest version the last time I checked).
and the YV12 Quicktime codec available here:
http://www.unthinkable.com/yv12codec.htm
By compiling xport and ldecod using xCode there is now a complete workflow from .m2ts to a Quicktime reference movie (playable in Final Cut without the need for rendering) using only OS X

The only gripe I have is how slow ldecod is, I guess that is to be expected for a reference implementation.

drmpeg
24th October 2006, 08:11
Thanks for your help Ron!
Using your tool, the H.264/AVC Reference Software available here
http://iphome.hhi.de/suehring/tml/download/ (jm11.0.zip was the latest version the last time I checked).
and the YV12 Quicktime codec available here:
http://www.unthinkable.com/yv12codec.htm
By compiling xport and ldecod using xCode there is now a complete workflow from .m2ts to a Quicktime reference movie (playable in Final Cut without the need for rendering) using only OS X

The only gripe I have is how slow ldecod is, I guess that is to be expected for a reference implementation.
Cool! I was hoping you would pick up on the reference decoder. Of course, like all reference decoders, it's slower than cold molasses. Now that you've got the workflow going, you can search for faster decoder source code.

Ron

drmpeg
24th October 2006, 09:52
it works perfectly on all files except those sony samples
h264_parse is a little buggy. The AVCHD streams fail because they have Picture timing SEI messages with cpb_removal_delay and dpb_output_delay fields. If you look at the code in the Picture timing SEI message parser, there's an obvious bug:

case 1: // picture timing
if (dec->CpbDpbDelaysPresentFlag) {
printf(" cpb_removal_delay: %u\n",
payload_bs.GetBits(dec->cpb_removal_delay_length_minus1 + 1));
printf(" dpb_output_delay: %u\n",
payload_bs.GetBits(dec->cpb_removal_delay_length_minus1 + 1));
}

It's incorrectly using the size of cpb_removal_delay_length_minus1 to get the dpb_output_delay field.

It should be:

case 1: // picture timing
if (dec->CpbDpbDelaysPresentFlag) {
printf(" cpb_removal_delay: %u\n",
payload_bs.GetBits(dec->cpb_removal_delay_length_minus1 + 1));
printf(" dpb_output_delay: %u\n",
payload_bs.GetBits(dec->dpb_output_delay_length_minus1 + 1));
}

The variable dpb_output_delay_length_minus1 isn't in the original code. It needs to be added to mp4av_h264.h and needs to be updated in h264_hrd_parameters() like so:

void h264_hrd_parameters (h264_decode_t *dec, CBitstream *bs)
{
uint32_t cpb_cnt;
dec->cpb_cnt_minus1 = cpb_cnt = h264_ue(bs);
uint32_t temp;
printf(" cpb_cnt_minus1: %u\n", cpb_cnt);
printf(" bit_rate_scale: %u\n", bs->GetBits(4));
printf(" cpb_size_scale: %u\n", bs->GetBits(4));
for (uint32_t ix = 0; ix <= cpb_cnt; ix++) {
printf(" bit_rate_value_minus1[%u]: %u\n", ix, h264_ue(bs));
printf(" cpb_size_value_minus1[%u]: %u\n", ix, h264_ue(bs));
printf(" cbr_flag[%u]: %u\n", ix, bs->GetBits(1));
}
temp = dec->initial_cpb_removal_delay_length_minus1 = bs->GetBits(5);
printf(" initial_cpb_removal_delay_length_minus1: %u\n", temp);

dec->cpb_removal_delay_length_minus1 = temp = bs->GetBits(5);
printf(" cpb_removal_delay_length_minus1: %u\n", temp);
dec->dpb_output_delay_length_minus1 = temp = bs->GetBits(5);
printf(" dpb_output_delay_length_minus1: %u\n", temp);
dec->time_offset_length = temp = bs->GetBits(5);
printf(" time_offset_length: %u\n", temp);
}

Also, the size of bitstream chunks that h264_parse is reading is too small for higher bitrate streams. Change:

#define MAX_BUFFER 65536

to

#define MAX_BUFFER 65536 * 4

Ron

bond
24th October 2006, 22:15
sounds interesting, can you make a patch for mpeg4ip?

drmpeg
25th October 2006, 06:32
sounds interesting, can you make a patch for mpeg4ip?
Here's the two updated files:

http://www.w6rz.net/main.cpp
http://www.w6rz.net/mp4av_h264.h

Ron

bond
25th October 2006, 19:21
Here's the two updated files:

http://www.w6rz.net/main.cpp
http://www.w6rz.net/mp4av_h264.h

Ronthanks! i linked the mpeg4ip devs to this fix

pstdenis
26th October 2006, 02:20
What is preventing the existing open source tools from decoding these AVCHD files? is it lack of support for parts of the AVC specification or a buggy implementation of these parts? Googling HDMV brings up very little other than it is part of the Blu-Ray specifcation is HDMV different than AVCHD?

bond
26th October 2006, 16:20
What is preventing the existing open source tools from decoding these AVCHD files? is it lack of support for parts of the AVC specification or a buggy implementation of these parts? Googling HDMV brings up very little other than it is part of the Blu-Ray specifcation is HDMV different than AVCHD?useage of interlaced propably

pstdenis
27th October 2006, 23:20
PAFF interlacing is not implemented is the error
and
BAFF + spatial direct mode is not implemented
from today's svn of mplayer.

Is there any open source project which does AVC decoding without using libavc?

bond
28th October 2006, 12:05
PAFF interlacing is not implemented is the error
and
BAFF + spatial direct mode is not implemented
from today's svn of mplayer.

Is there any open source project which does AVC decoding without using libavc? nope :)

kensystem
30th October 2006, 16:21
Finding the stream demuxer in open source tools sure has been hard. Also finding the PAFF interlace support. I broke down and paid $20 for CoreAVC which does the interlace, but doesn't come with a demuxer.. had to use one that came with another shareware product.

BTW I can generate and post these files at any of the bitrates that sony's HDR-SR1 can create, if anyone wants samples to play with. mail me at ffmpeg-user at onnet.cc.

Small one at http://onnet.cc/20061022153649.m2ts

kensystem
30th October 2006, 16:35
BTW, it's noteworthy I think, that these m2ts files are also the stream containers being used on Bluray discs.. In fact the software that comes with the sony camcorders has an option to 'Create AVCHD disc', which (after performing some file modification) basically places the raw m2ts files into the 'stream' folder on disc. The entire resulting file/directory structure looks just the like the documented Bluray one. It uses the simpler HDMV menu system. So, it seems to really be creating a 'Bluray' disc, except that if you do this with 4.7 GB media, it may not be on the UDF filesystem (I haven't yet checked if it's UDF, ISO, Joliet)

SeeMoreDigital
30th October 2006, 16:45
Thanks Ken,

Lots of "feet" in your sample...


Bond, do you know if anybody has asked whether .M2TS support can be added to MP4Box?


Cheers

kensystem
30th October 2006, 17:43
Thanks Ken,

Lots of "feet" in your sample...



Yes, it was just the smallest file I could find from what I'd shot that day. It shouldnt be used to get a feel for the video quality -- I can make some samples for that if anyone asks.

BTW I think the codec efficiency is really good. Pictures are stunning even though the camera controls (iris and focus namely) are very disappointing. From what I can tell, the stream is VBR (as has been discussed) - but the Quality (MB/s) setting you choose is actually the mean peak one (not mean average), and it only drops bitrate for low motion/complexity scenes. In other words 15 Mb/s will peak up to around 16MB, and drop to maybe 10 for simple video. I will actually test that tonight.

bond
30th October 2006, 20:37
Thanks Ken,

Lots of "feet" in your sample...


Bond, do you know if anybody has asked whether .M2TS support can be added to MP4Box?


Cheers
afaik .ts is already supported

SeeMoreDigital
30th October 2006, 21:42
afaik .ts is already supportedYes indeed, regular .TS is supported.

However, I've had little success using MP4Box to de-mux streams placed within .M2TS - It reports: "File has no selectable tracks" :(

On a more positive note MP4Box is able to de-mux (MPEG-2 video/ MP2 audio) streams placed within .M2T :D


Cheers