TSファイルの分割2010/07/19 21:00

 「アナログしか見てないから関係ない、停波したら見なけりゃいいし」などと言っていたのに、地デジを使いまくるようになってしまった。理由は、例の"PT2"を(割高だったけど)手に入れたため。Linux上でも問題ない、というかむしろ使いやすいんじゃなかろうか?
電波強度の問題があってPT2で録画してからの視聴となる(ブースターは高いからなあ)ものの、PT2NASというものを導入したおかげで録画が手間になることはない。実際の視聴はTSファイルがそのまま使えるネットワークメディアプレーヤーを使用。早送りや巻き戻しに難があるけど、画質自体は無問題。

 さて。ところが、たまに視聴できないファイルがある。PT2の動作の問題で、実際の番組開始の20秒前(大抵はCM)から録画開始となっているのだが、このマージンを越えて再生することができないことがある。最後まで表示していた画面が固まったままになったり、画像は止まったままなのに音だけ聞こえたり。同じファイルをLinux上で再生しても、やはり同じ箇所で止まる。ためしに先頭部を適当に削除してみると、問題なく再生できる。
 これは番組が切り替わるときに解像度とかが変わるのに再生側が追随できていないのだろう。mencoderやffmpegでどう扱えばいいのかわからず、またTSファイルについて軽く調べたところわりと簡単にできそうなのでプログラムを組んでみることにした。

 参考にしたのは以下の資料。(リンクにするのもめんどくさい)
http://www.mpeg.co.jp/libraries/video_it/video_03.html
http://www.mpeg.co.jp/libraries/video_it/video_04.html
http://www.mpeg.co.jp/libraries/video_it/video_06.html
http://www.mpeg.co.jp/libraries/video_it/video_07.html
http://allegro.dtiblog.com/blog-entry-185.html
http://allegro.dtiblog.com/blog-entry-187.html
ただこの資料でも(PATの形式などで)どーもアバウトなところがあって、Wikipediaの方が参考になる箇所もあった。
http://en.wikipedia.org/wiki/Program_Specific_Information


 わかったのはおおまか次のようなこと。
  • TSファイル(MPEG2のトランスポートストリーム)は188バイトごとのパケットに分割される
  • パケットのヘッダ部にパケット識別子(PID)というものがある
  • PIDが0のパケットはPAT(Program Association Table) であり、ストリームに含まれている番組(プログラム)の一覧(PMTのPIDとして)をあらわす
  • PMT(Program Map Table)パケットには、その番組に含まれるデータのPID(映像とか音声とか)が入っている。
 手持ちのTSファイルをなめたところ、PATもPMDも(内容が変わらなくとも)何度も繰り返し現れる。放送を前提(つまりはエラーを前提)としての冗長化だから当然であるが。また、途中から再生できないファイルでは、PATやPMDの内容が途中で変わっていた。
 つまり、PATやPMDが変更するタイミングでファイルを分割してやれば、個々のファイルの再生には問題なくなるはず・・・。
 と、ここまで書いて疲れたので、続きはまた今度。

コメント

_ Foot Pain symptoms ― 2015/08/02 14:04

Excellent blog! Do you have any tips and hints for aspiring writers? I'm planning to start my own site soon but I'm a little lost on everything. Would you recommend starting with a free platform like Wordpress or go for a paid option? There are so many choices out there that I'm completely confused .. Any suggestions? Many thanks!

_ Grow Taller Program ― 2015/08/02 23:07

whoah this weblog is wonderful i love studying your articles. Keep up the good work! You understand, many individuals are hunting round for this info, you can aid them greatly.

_ 100 Free Plenty Fish Dating ― 2015/10/16 13:27

I am truly happy to read this website posts which contains plenty of helpful facts, thanks for providing such statistics.

_ Www.plenty Of Fish.com ― 2015/10/16 17:30

I love it when people come together and share opinions. Great website, stick with it!

_ Plentymorefish.com ― 2015/10/17 21:39

wonderful points altogether, you just received a new reader. What may you suggest about your put up that you simply made a few days in the past? Any sure?

_ Plenty of fish dating site of free dating ― 2015/10/18 04:49

Good day! I know this is kinda off topic however I'd figured I'd ask. Would you be interested in trading links or maybe guest writing a blog article or vice-versa? My blog goes over a lot of the same subjects as yours and I feel we could greatly benefit from each other. If you happen to be interested feel free to send me an email. I look forward to hearing from you! Terrific blog by the way!

_ sale quest bars ― 2015/10/18 17:58

Excellent beat ! I would like to apprentice while you amend your website, how could i subscribe for a blog site? The account aided me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear idea

_ quest bars nutritional values ― 2015/10/19 05:59

hello!,I love your writing very so much! proportion we keep up a correspondence extra approximately your post on AOL? I require a specialist on this space to unravel my problem. May be that is you! Having a look ahead to peer you.

_ forskolin weight loss ― 2015/11/03 16:59

you are in point of fact a just right webmaster.
The website loading speed is incredible. It sort of feels that you're doing any unique trick.
In addition, The contents are masterwork. you have done a great task on this matter!

_ plenty of fish dating site of free dating ― 2015/11/06 08:48

I am sure this paragraph has touched all the internet visitors,
its really really fastidious article on building up new website.

_ plenty of fish dating site of free dating ― 2015/11/06 16:00

I have been exploring for a little for any high-quality articles or
blog posts on this sort of area . Exploring in Yahoo I at
last stumbled upon this website. Studying this information So i'm satisfied to exhibit that I've an incredibly good uncanny feeling I discovered just
what I needed. I most without a doubt will make certain to don?t disregard this site and provides it a look on a relentless basis.

_ plenty of fish dating site of free dating ― 2015/11/06 19:52

Thank you for sharing your thoughts. I truly appreciate your efforts and I
am waiting for your further post thank you once again.

_ kroger digital coupons ― 2015/11/11 18:58

Good day! I just wish to offer you a big thumbs up for your
great information you have got here on this post. I'll
be coming back to your website for more soon.

_ kroger digital coupons ― 2015/11/17 11:53

Hello, its good article concerning media print, we all understand
media is a fantastic source of information.

_ krogerfeedback.com ― 2015/12/10 00:55

Fascinating blog! Is your theme custom made or did you download
it from somewhere? A theme like yours with a few simple adjustements would really make my blog jump out.
Please let me know where you got your theme. Bless you

_ krogerfeedback.com ― 2016/01/01 00:25

Hi there, after reading this amazing paragraph i am too cheerful to share my knowledge
here with friends.

_ quest bars !!! ― 2016/01/07 13:29

Very good article. I will be dealing with many of these issues as well..

_ Descargar Firefox :::: ― 2016/01/09 01:46

I'm amazed, I have to admit. Rarely do I come across a blog
that's equally educative and amusing, and without a doubt, you've hit the nail on the head.
The problem is an issue that too few folks are speaking intelligently about.
I'm very happy that I found this during my search for something
regarding this.

_ quest bars ― 2016/02/09 05:03

Greetings from Colorado! I'm bored to tears at work
so I decided to check out your site on my iphone during lunch break.
I really like the info you present here and can't wait to take a look when I get home.
I'm shocked at how quick your blog loaded on my
cell phone .. I'm not even using WIFI, just 3G ..
Anyways, superb site!

_ quest bars ― 2016/02/09 11:00

Good post. I learn something new and challenging
on sites I stumbleupon every day. It's always helpful to read
articles from other authors and use something from their websites.

_ quest bars ― 2016/02/17 22:30

Have you ever considered writing an ebook or guest authoring on other websites?
I have a blog based on the same topics you discuss and would really
like to have you share some stories/information.
I know my visitors would enjoy your work. If you are even remotely interested, feel free to shoot me an email.

_ minecraft.exe ― 2016/02/22 02:39

Great web site. A lot of useful info here. I am sending it to several buddies
ans also sharing in delicious. And obviously, thanks to your
sweat!

_ bernie sanders ― 2016/04/01 00:54

It's a pity you don't have a donate button! I'd most certainly donate to this fantastic blog!
I guess for now i'll settle for book-marking and adding your RSS feed to my Google account.
I look forward to fresh updates and will talk about this blog with my Facebook group.
Chat soon!

_ bernie sanders ― 2016/04/01 09:00

My brother suggested I might like this web site. He was once entirely right.

This put up truly made my day. You cann't imagine just how a lot time I had spent for this info!
Thanks!

_ bernie sanders ― 2016/04/01 18:22

This is the right web site for anyone who wishes to find out about this topic.

You realize a whole lot its almost tough to argue with you (not that I really would want to…HaHa).
You definitely put a new spin on a subject that has been written about for years.
Excellent stuff, just wonderful!

_ walmart credit login ― 2016/05/28 05:49

Thank you for the good writeup. It in fact was a amusement account
it. Look advanced to more added agreeable from you! By the way, how can we communicate?

_ www.krogerfeedback.com ― 2016/06/06 03:11

Greetings! I've been reading your website for a while
now and finally got the courage to go ahead and give you
a shout out from Huffman Tx! Just wanted to tell you keep
up the good work!

_ Mincraft ― 2016/07/03 06:28

Wow, this piece of writing is fastidious, my younger sister is
analyzing such things, so I am going to let know her.

_ www.krogerfeedback.com ― 2016/07/14 20:25

This is my first time pay a visit at here and i am truly pleassant to read everthing
at one place.

_ kroger digital coupons ― 2016/07/28 12:47

Heya i am for the first time here. I came across this board and
I find It truly useful & it helped me out much. I hope to give something back
and aid others like you helped me.

_ www.krogerfeedback.com ― 2016/07/30 17:11

I am sure this article has touched all the internet users, its really really fastidious paragraph on building up new website.

_ fix connections to bluetooth audio devices and wireless displays in windows 10 ― 2016/08/19 06:25

Hi! I'm at work surfing around your blog from
my new apple iphone! Just wanted to say I love reading
through your blog and look forward to all your posts!

Carry on the superb work!

_ Windows 10 Free Upgrade ― 2016/09/14 20:35

you are in point of fact a good webmaster. The web site loading pace is amazing.
It sort of feels that you are doing any distinctive trick.

Also, The contents are masterpiece. you've done a great
process in this topic!

_ Windows 10 Free Upgrade ― 2016/09/17 07:34

Wow, wonderful blog layout! How long have you been blogging for?

you make blogging look easy. The overall look of your website is magnificent, as well as
the content!

_ quest bars ― 2016/09/24 21:51

Great post. I used to be checking continuously this blog and
I'm inspired! Extremely helpful info specially the final phase :) I deal with such
information much. I was looking for this particular information for a long time.
Thank you and good luck.

_ quest bars ― 2016/09/25 20:36

I savour, result in I found exactly what I used to be looking
for. You've ended my 4 day long hunt! God Bless you man. Have a great day.
Bye

_ minecraft unblocked games sweet and awesome ― 2016/10/02 03:20

I don't even know how I ended up here, but I thought this post was great.
I do not know who you are but certainly you're going to a famous blogger
if you are not already ;) Cheers!

_ plenty of fish dating site of free dating ― 2016/10/04 07:43

Yes! Finally something about plenty of fish dating
site of free dating.

_ quest bars ― 2016/10/06 10:22

Hello to all, for the reason that I am actually keen of reading this web
site's post to be updated daily. It includes fastidious information.

_ como descargar minecraft para windows 10 ― 2016/10/12 23:25

What's up, the whole thing is going nicely here and ofcourse every one
is sharing information, that's genuinely good, keep up writing.

_ descargar minecraft pocket edition ― 2016/10/13 21:03

Hi there, i read your blog from time to time and i own a similar one and i
was just curious if you get a lot of spam responses?
If so how do you reduce it, any plugin or anything you can suggest?
I get so much lately it's driving me crazy so any assistance is very much appreciated.

_ descargar minecraft ― 2016/10/14 05:52

Hello Dear, are you really visiting this web site on a
regular basis, if so after that you will absolutely obtain fastidious know-how.

_ juegos minecraft gratis ― 2016/10/14 23:40

I'm really inspired along with your writing skills and also with the layout for your
blog. Is this a paid theme or did you customize
it your self? Anyway keep up the nice high quality writing,
it's uncommon to see a great weblog like this one today..

_ gamefly 3 month free trial ― 2016/11/15 17:34

Greate post. Keep writing such kind of information on your site.

Im really impressed by it.
Hi there, You've done an incredible job. I'll definitely digg it and in my opinion recommend
to my friends. I'm sure they'll be benefited from this web site.
Gamefly 3 month free trial

_ t.co ― 2016/12/02 07:36

You actually make it seem so easy with your presentation but I find this matter to be really something which I think I would never understand.

It seems too complicated and very broad for me.
I'm looking forward for your next post, I'll try to get the hang of it!

_ Gamefly Free Trial ― 2016/12/18 11:10

My coder is trying to convince me to move to .net from
PHP. I have always disliked the idea because of the costs.
But he's tryiong none the less. I've been using Movable-type
on several websites for about a year and am concerned about switching to another platform.
I have heard great things about blogengine.net.
Is there a way I can transfer all my wordpress content into it?
Any kind of help would be really appreciated!

_ Gamefly ― 2016/12/19 02:35

Truly no matter if someone doesn't be aware of afterward its
up to other viewers that they will help, so here it happens.

_ Gamefly Free Trial ― 2016/12/20 09:11

I constantly spent my half an hour to read this web site's posts daily
along with a cup of coffee.

_ www.krogerfeedback.com ― 2016/12/25 08:31

I'm more than happy to uncover this great site.
I want to to thank you for your time due to this fantastic read!!
I definitely appreciated every bit of it and i also have you bookmarked to see new stuff on your
website.

_ www.krogerfeedback.com ― 2016/12/25 09:01

Hello! Would you mind if I share your blog with my zynga group?
There's a lot of folks that I think would really enjoy
your content. Please let me know. Many thanks

※コメントの受付件数を超えているため、この記事にコメントすることができません。

トラックバック

このエントリのトラックバックURL: http://napple.asablo.jp/blog/2010/07/19/5227695/tb