Log in

View Full Version : Synchonisation Problems Sony HX9V


rodgar
17th August 2012, 14:31
Since 18 month I encode all of my families old Homevideos to make them AVCHD-compatible. In the end, I have one MKV per event (Vacation, Birthday etc.) with Subs and Chapters - And if I want, I can put it in tsMuxer to make a burnable AVCHD Stucture.

Since that, I get in touch with the following AVCHD-Camcorders: Canon HF S100, Panasonic V500EG, Panasonic TZ31 and Sony HX9V.
I have no problem with all of them except the HX9V. Many Videos are sightly out of Sync but not all of them - Not a big deal I thought. But the problem is, if joined together with tsmuxer or tsdemux the beginning is ok, but in the end I have almost a second or more mismatch - audio behind video.

So I have 2 Questions:
1. Is there a way to analyse the audio and video through avisynth - maybe to get something like "videoclip1 ends here <frame>" "audioclip1 ends here <frame>" and so on... or a working solution for this mess? Or a script or tool which shows the differences between a working clip and a not-working one.

2. More general: Why is this only a HX9V problem? In fact I could understand if NO joined MTS from any camcorder would be in sync because of the different length of audio and video and because almost every MTS has a positive or negative audiodelay, but why does it work fine everytime except with the HX9V?

Here are two original Videos taken with the HX9V. First (00075) is in sync, second (00076) is not - But both of them have a 32ms audiodelay (DGIndexNV).
http://speedy.sh/AJWhW/2011.11.26.zip

P.S.
Sorry for writing in german before, lost my head

Ghitulescu
17th August 2012, 15:39
There is a CD that comes with this camera (it's not a camcorder, neither the Panasonic). You should always use the provided software, this is the only software that knows exactly how are the files obtained.

rodgar
17th August 2012, 20:08
The only thing I can do with this Software is to view my videos and transcode them to WMV - So how exactly does this solve my problem?
On the other side, the provided Software isn't even able to read pure MTS-Data without the AVCHD-Structure on the SD-Card. So what if you don't have this structure anymore?

rodgar
18th August 2012, 14:53
No one? No idea?

poisondeathray
18th August 2012, 16:38
So what if you don't have this structure anymore?

This doesn't help you - but the folder structure and metadata within is what other programs like video editors use to seamlessly join the clips . Programs like tsmuxer don't look at it, so you might get gaps and sync issues. If you import without it into NLE's, you get gaps and sync issues as well in those programs

neuron2 wrote a program called "joints" it might help you (I haven't used it , don't know how well it works)

rodgar
18th August 2012, 22:50
:thanks: I'll check it right now... Hope it'll work.
BTW - Here's the Link for Joints: http://forum.doom9.org/showthread.php?t=149441

But for the future: What tool would you recommend to join MTS-Files - even within an AVCHD-Structure? tsmuxer and tsdemux is the only way I know.

poisondeathray
18th August 2012, 23:03
But for the future: What tool would you recommend to join MTS-Files - even within an AVCHD-Structure? tsmuxer and tsdemux is the only way I know.

I don't know of any that can 100% join successfully and accurately without the folder structure.

I don' t know of any freeware that can do this either, except as Ghitulescu recommended earlier, usually the camera will have software bundled to append the files (but it usually only works if you have the complete folder structure and metadata) . Check the Sony site if there are other options, it might be something you have to download (not included on a DVD)

rodgar
19th August 2012, 03:42
After a lot of testing and reading the whole Joints-Thread, I am a little disapointed. Joints doesn't help, eac3to neither.

This is a Cutlist of Joints after processing some of my files:
00071.mts,1209,1512,0,1511
00072.mts,442,553,1512,553
00073.mts,1352,1690,2065,1690
00074.mts,793,992,3755,991
00074.mts,793,992,4747,991
00075.mts,390,488,5739,488
00076.mts,1196,1495,6227,1495
00077.mts,312,390,7722,390

So it does its work, but the mismatch in sync is as big as always. I don't get it. The problem doesn't seem to appear because of the "little" time delays at the end or the beginning of a file, but somewhere else.

Played all by itself most videos aren't in sync, but only with a small mismatch. But if I only join 2 of them together, at the first cut there's almost a second of mismatch. How is that possible??

Video and audio of the joined material have only a 32ms difference. Pretty normal to me. How could that make a second or more during playback? With a player where every other File is perfectly in Sync!? I'm completely lost.

Ghitulescu
20th August 2012, 10:27
No one? No idea?

You won't like this idea ... ;)

Sony and Panasonic (the manufacturers of the last two of your "camcorders") do manufacture also true camcorders. This is their way of telling you that you use a device in an improper way (and that you should buy/use a camcorder instead). Providing cameras that do the job of a camcorder, why would one buy the camcorder instead?

Since only Sony knows how the files are, I believe you should ask them, in the end it's a legitimate question, at least during the warranty period.



I assume you have a file or two at hand (and you own the copyright). You may want to upload it/them somewhere, for other members to have a look at them.

cretindesalpes
20th August 2012, 11:29
Demuxing audio and video, joining them separately then muxing the result works fine; at least using matroska tools for joining and muxing. I don't know if your TS tools only can do this correctly. I couldn't make tsmuxer work, it just stops randomly during the processing.

Ghitulescu
20th August 2012, 13:25
How could you download it? I am directed to buy an account instead ....

Guest
20th August 2012, 14:14
So it does its work, but the mismatch in sync is as big as always. I don't get it. The problem doesn't seem to appear because of the "little" time delays at the end or the beginning of a file, but somewhere else. Post a link to two of your source MTS files that, when joined, produce this async. I will try to figure out why it is happening.

rodgar
20th August 2012, 16:39
Sorry for the late response... on top of all, my Computer crashed last night... And again sorry for that speedy.sh upload. Hope the next one is better.

@neuron2
Thank you very much... Your help is most welcome.

Unfortunately my Upload is really slow. So I hope, I can provide the files within the next 5 hours. I will upload both: My joined file (tsmuxer) and the single original MTS's.

Guest
20th August 2012, 16:59
OK, cool.

Did you try joining with simple copy /b or demuxing from DGIndexNV? Is it only tsmuxer joining that produces the problem?

Finally, can you describe your complete process, from the source files all the way through to the method you used to observe a desync?

Ghitulescu
20th August 2012, 17:36
My joined file (tsmuxer) and the single original MTS'.

How can you join a single file?

Guest
20th August 2012, 18:27
The apostrophe at the end indicates plural:

single original MTS's.

or:

single original MTSs

I usually use the apostrophe only when both are lower case, so I would
say MTSs.

It's highly controversial and grammarians love to fight about it.

rodgar
20th August 2012, 23:03
finally... upload is done:
http://www.mediafire.com/?kq88sub5ffse885
http://www.mediafire.com/?ozs8et43ea84eqp
http://www.mediafire.com/?1k03guma4cnxog6
http://www.mediafire.com/?b1y6g869gp0l8ey
http://www.mediafire.com/?cv3xol9t3xwc15g

5 Files packed with 7Zip due to 200MB Limitation of mediafire

My System:
MS Windows 7 Ultimate 64-bit SP1
AMD Phenom II X4 965
BGeForce GTX 260
8.0GB Dual-Kanal DDR3

I shortened my workflow down to the only 2 actions of copying the files to harddrive via WindowsExplorer and simply joining the original MTS Files with tsmuxer. That is enough to observe desync... at least on my system. If this MTS is transcoded (as described below) and put into a MKV-Container both, my system AND my Samsung D6500 TV via DLNA, shows desync as well. But only with Sony HX9V. Every other Camcorder and Camera (this one's for you Ghitulescu :) works fine.

And here's my complete usual workflow - if you need it. I made a small GUI with autohotkey to automate most of the following steps (to explain how step2 is done):

1. copy all MTS-Files into one folder to my harddrive via WindowsExplorer
2. check if Modification time of the Files is correct and set it to the right time zone (my parents always forget to set this up when they travel so I have to fix it)
3. sort files into subfolders (all of one day into one folder)
4. join all MTS-Files from each folder into one file per folder
metafile for tsmuxer:
MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr --vbv-len=500
V_MPEG4/ISO/AVC, "file1.mts"+"file2.mts"+... , fps=25, insertSEI, contSPS, track=4113
A_AC3, "file1.mts"+"file2.mts"+... , track=4352

(I then have one MTS per day - and desync shows up with HX9V)
5a. because I don't know how to read frames or length in sec from an MTS-File in autohotkey (Don't know anything about the Header-Structure), I use tsdemux to join those "onevideoperday"-videos to one big video. I only do this because tsdemux gives me a chapter.xml in which every single video is listed as a chapter. I convert this file into SRT-Subtitles - So I have a chapter per day and a subtitle which can display what date it was and whats happening.
5b. Because tsdemux isn't that reliable, I join those "onevideoperday"-videos in parrallel with tsmuxer to have one big MTS-File to finally work with.
6. This MTS-File enters DGIndexNV to get a DGI, an AVS-File and the ac3 with time-delay
6b. New one: ac3 enters Joints
7. With the AVS-File I transcode the video with the following line for AVCHD/BD (if its small enough AVCHD - if not same one for Bluray but with buffer 30k and maxrate to 40k ):
program --level 4.1 --bluray-compat --pass 2 --bitrate <bitrate> --stats ".stats" --keyint 25
--open-gop --slices 4 --vbv-bufsize 14000 --vbv-maxrate 14000
--tff --colorprim bt709 --transfer bt709 --colormatrix bt709 --sar 1:1 --output "output" "input"
8. I take the final transcode and mux it with the Joints-ac3 from before, the chapters and the srt alltogether with MKVMergeGUI.
9. Final MKV is ready for my archive and can now be transferred into AVCHD or BD with the use of tsmuxer whenever needed.

Works perfectly for all of my projects since almost 18month but not with the Sony HX9V.

@neuron2
I only tried to join with tsdemux and tsmuxer - desync with both of them. Thought tsmuxer simply use the copy /b command - have to check this method. Stupid Question: Is DGIndexNV able to join MTS? I would love to use it instead.
Edit: Same result with copy /b

@Ghitulescu
I only forgot the s ... sorry again :) ... I'll correct this right away.

Guest
21st August 2012, 01:49
I am not going to try to debug your complicated Rube Goldberg process. Here is what I did.

I downloaded your 5 MTS files. I opened all of them together in DGIndexNV. I did Save Project as 00073.dgi. I then opened this script in VirtualDub:

loadplugin("dgdecodenv.dll")
vid = dgsource("00073.dgi")
aud = nicac3source("00073 PID 1100 2_0ch 48KHz 256Kbps DELAY 0ms.ac3")
audiodub(vid,aud)

It plays perfectly and completely in sync throughout. DGIndexNV implemented the joints-like processing when demuxing the audio.

Therefore, you can trancode the video using this script as input to x264 and then mux it with this audio and you should not experience any issues.

And yes, you can join MTS's with DGIndexNV. Open them all and then Output Trimmed TS (without trimming). But since you are transcoding, there's no point to even bother trying to join the MTS's (just open them together in DGIndexNV).

BTW: She's a great pianist. Bravo! Encore!

rodgar
21st August 2012, 12:21
My "complicated Rube Goldberg process" is not what causes the desync, it's only the joining of 5 Files with tsmuxer. Therefore I uploaded the joined Video as well.
You said it plays in sync during your process... but plays my "joined_with_tsmuxer_original.m2ts" fine also?
Because your way is giving me the exact same result as before: desync

So the reason is definitely on players side, but why only with those HX9V-Files?
---
Edit: MPC-HC + CoreAVC + AC3(intern) -> desync
Samsung D6500 via DLNA -> desync
VLC -> sometimes sync sometimes desync
Splashplayer -> sync
No need to mention: only with HX9V-Files
---

DGIndexNV implemented the joints-like processing when demuxing the audio.
So no need for joints, good to hear that :)

BTW: The rest of my process is not as rubbsih to me as it is to you, because I'm no professional programmer and found no other way to get my chapter-list. If you show me a simpler solution to get a chapter per day I would really appreciate that.

Guest
21st August 2012, 13:56
You said it plays in sync during your process... but plays my "joined_with_tsmuxer_original.m2ts" fine also? I made a project in DGIndexNV with your joined file and then played the script in VirtualDub. It was in sync throughout.

Because your way is giving me the exact same result as before: desync Let's be sure we are talking about the same thing here. My process was to simply play the script in VirtualDub. Have you done that? If you have gone beyond that process, you have to tell me exactly what you did. And again, to be clear, you mentioned a one-second desync. Is that what you still observe with these samples?

rodgar
21st August 2012, 14:49
I openened the video exactly like you did. In VD everything is fine.

After that I openend all files (The 5 I uploaded) in DGIndexNV and joined them like you said "Output Trimmed TS (without trimming)". This file plays back well in Splash but with tremendous desync in MPC-HC and only sometimes fine in VLC - exactly like before with tsmuxer or tsdemux. The Desync is growing during time. It's hard to say exactly how much, but at least a second at the end of this video.
After that I put it into an MKV-Container because my TV doesn't playback MTS-Files. Ths MKV shows exact the same desync-behaviour like the ts does: Splash plays well, VLC sometimes, MPC-HC and the TV: desync.

I checked the time during videoplayback with a stopwatch. Somehow the videoduration is longer than it should be. It seems audioplayback is correct but video is to slow. It looks exactly like my PC hasn't enough power to decode the videoframes in time... But again: why only with HX9V? The files of the Canon HF-S100 have more Bitrate (27mbps) but are playing fine. And if it's only my PC, why is my TV showing the same result?

poisondeathray
21st August 2012, 15:06
I didn't look at any of your samples - were they 1080p59.94 (i.e. "60p") ? That's what the HX9V uses in the highest quality mode. It's a lot more intensive to play (bitrate has less of a role) than "regular" AVCHD 1080i59.94 (ie. "60i")

If so, it's not supported by many hardware devices yet (it falls under AVCHD 2.0 specs, which only a few newer models support offically, but some may still play it)

rodgar
21st August 2012, 15:14
@poisondeathray
Thats right, but my footage is 1080i50

Guest
21st August 2012, 15:23
I openened the video exactly like you did. In VD everything is fine. OK, so far so good.

After that I openend all files (The 5 I uploaded) in DGIndexNV and joined them like you said "Output Trimmed TS (without trimming)". This file plays back well in Splash but with tremendous desync in MPC-HC and only sometimes fine in VLC - exactly like before with tsmuxer or tsdemux. The Desync is growing during time. It's hard to say exactly how much, but at least a second at the end of this video.
After that I put it into an MKV-Container because my TV doesn't playback MTS-Files. Ths MKV shows exact the same desync-behaviour like the ts does: Splash plays well, VLC sometimes, MPC-HC and the TV: desync. But now you are totally deviating from what I am suggesting. My process would continue with feeding the script to x264 and then muxing its output with the audio outputted by DGIndexNV. Chapters lists we can worry about later. Right now we are trying to analyze the desync.

[Aside: You asked if DGIndexNV could join MTS's and I replied yes and showed how. But it is equivalent to copy /b and that does not make totally kosher output because the timestamps are not adjusted to be contiguous. Some players may barf on it. But you could feed it back into DGIndexNV and work with it without issues. Anyway, that is not what I am suggesting and now I regret mentioning it because you've gone off into the weeds with it.]

Look, you were talking about re-encoding your videos and that's what I addressed. Now you are just trying to join MTS's and play the result?

You are jumping all over and thereby making it impossible to diagnose your issue.

So what is it? Are you trying to develop a working process or are you set on your existing one and are committed to finding a tool to reliably join MTS files? I can try to help either way but let's be perfectly clear so as not to waste time and effort.

poisondeathray
21st August 2012, 16:11
But for the future: What tool would you recommend to join MTS-Files - even within an AVCHD-Structure? tsmuxer and tsdemux is the only way I know.


For just joining clips (if still you have original folder structure and metadata) - use the bundled software :)

http://support.d-imaging.sony.co.jp/www/disoft/int/pmb/feature/edit/merge.html

If you've lost the bundled CD, then you can download a replacement from Sony
http://www.sony-mea.com/support/download/316131



If you're re-encoding it, then the DGIndexNV method outlined by neuron2 looks like it should work

rodgar
21st August 2012, 16:15
@neuron2
You're absolutely right... and I apologize for that. It's because by chance it happens a single fast transcode of one Day works perfect everywhere - Then I transcode the whole movie (for the 100th time) in automated 2pass just to see its desync again. Then I make a fast transcode of one Day again and see desync again. This issue is playing cat-and-mouse game with me... that's why I'm jumping around. But as said before I apologize for that.

I'll try to focus more and make a complete transcode of the whole movie with your method. Only need to install x264 VFW for VD because I usualy work with MeGui.
Edit: Couldn't get x264 to work with VD - x264 doesn't like my line which is for automated 2-pass. After trying to change it a little, it says something about interlace and weighted p-frame prediction is not supported. Since at least interlaced is crucial I use MeGui instead, hope that's ok!?

Only to see if I get something wrong - That's what I should do:
Open all MTS-files in DGIndexNV, save the DGI, demux audio and create AVS. Open AVS in VD and Transcode with x264... I'll say hello again if this is done.

Guest
21st August 2012, 18:36
Only to see if I get something wrong - That's what I should do:
Open all MTS-files in DGIndexNV, save the DGI, demux audio and create AVS. Open AVS in VD and Transcode with x264... I'll say hello again if this is done. Yes, but note that demuxing the audio is not a separate step. It happens when you Save Project with audio demux enabled. It's all described in the user manual. Use the audio demuxed by DGIndexNV; don't use a separate application.

Nobody in their right mind uses x264VFW IMHO.

rodgar
21st August 2012, 22:35
Transcode is done... I would now mux the video, DGIndexNV's ac3, chapters and Subtitles in MKV-Merge - Because chapters and Subtitles aren't present, I only take audio plus video... done.
Playback in MPC-HC... everything works fine... Playback on my TV... no desync. I would say: Yippee! :thanks:

... at least for this time. Unfortunately I had this result more than one time only to see the next video with desync again. But maybe not joining in tsmuxer made the problem gone - I hope so. The only thing left is to get those chapters per day. I see no other option than doing that in parrallel with tsdemux, but that's ok, as long video is in sync :)

Nobody in their right mind uses x264VFW IMHO.
So x264 within VD is no really option!?

poisondeathray
21st August 2012, 22:39
So x264 within VD is no really option!?


Besides x264vfw, other options: use vdub as a frameserver, or use the external encoder option - these aren't really "within" vdub but you get the idea

http://forums.virtualdub.org/index.php?act=ST&f=5&t=18789&

But you're using megui anyway, so why do you need vdub for anything ?

Guest
21st August 2012, 23:42
... at least for this time. Unfortunately I had this result more than one time only to see the next video with desync again. Post again if this process causes any issues for you down the road. I don't anticipate that, but you never know.

Perhaps others can help with your chapter list requirement; I don't ever work with such things. I'll review the thread again though to see if I can think of anything.

rodgar
22nd August 2012, 01:57
But you're using megui anyway, so why do you need vdub for anything ?
I use VD for my older miniDV, Hi8, VHS and Super8 Captures... but only for capture and sometimes filtering. I was only curious, because neuron2 opened the AVS in VD to check if its in sync - then press "Save as" is'nt that far away :)

@neuron2
Thanks for your help. I appreciate you're helping others way below your skills.

And for that Chapter-Issue:
Basically I only need to count the videoframes per MTS, with them I could create my own chapters. I do this with AVI-Files when Capturing with VD. I have only to search the Header of each file for that info - And the structure was listed in the AVI-Documentation - Unfortunately I couldn't find anything similar about MTS-Files... Do you eventually know a ressource like wotsit.org but with info about MTS?

Guest
22nd August 2012, 11:20
And for that Chapter-Issue:
Basically I only need to count the videoframes per MTS, with them I could create my own chapters. The cut list file produced by the Joints program contains the frame counts for each file.

MTS is just a transport stream with a 4-byte timestamp before each sync byte.

rodgar
22nd August 2012, 11:53
The cut list file produced by the Joints program contains the frame counts for each file.
Yes I saw that and I'm already on it to use that cutlist-File. But I thought, maybe I could implement my own little Framecount. So I have to find and count those sync-Bytes to get what I want? How hard can that be? :)

Edit: Second Movie is transcoded... No desync. Wondering what tsmuxer did to the files while joining to produce this massive desync.

Guest
22nd August 2012, 14:37
Yes I saw that and I'm already on it to use that cutlist-File. But I thought, maybe I could implement my own little Framecount. So I have to find and count those sync-Bytes to get what I want? How hard can that be? No, you don't count transport sync bytes. Look at the code for Joints if you want some ideas. You have to fully parse the elementary video stream and count frames. Parsing is far from trivial and involves much more that bumping a count when you see a certain byte sequence. Furthermore it is different for MPEG2, AVC, and VC1.

Wondering what tsmuxer did to the files while joining to produce this massive desync. Probably violating T-STD buffering and/or splicing constraints specified in ISO 13818-1. Concatenating transport streams is also far from a trivial matter. Read the relevant sections of the spec to see what can go wrong.

rodgar
22nd August 2012, 16:25
I know it's far away from beeing easy... I was only joking :)
In fact I think the whole matter is far beyond my knowledge - But I try to learn. Reviewing old posts of you (Especially http://forum.doom9.org/archive/index.php/t-145856.html), I saw your library now asks for username and password, why is that?
I peeked into the Joints Sourcecode but understood almost nothing. At the moment I try to understand at least something from what I can find... maybe it helps:
https://github.com/lerks/BluRay/wiki/ApplicationFormat
http://dvd.sourceforge.net/dvdinfo/pes-hdr.html
http://dvd.sourceforge.net/dvdinfo/mpeghdrs.html

Guest
22nd August 2012, 18:42
I saw your library now asks for username and password, why is that? I don't hold the copyrights to the material in there and so have no license to distribute it. It's there for my personal use only. Sorry about that.

The AVC and MPEG2 specs are easily available, VC1 I've never seen freely available online.

rodgar
27th August 2012, 12:46
And how did you learn about VC-1?

Ghitulescu
27th August 2012, 14:09
Standards can be bought :)

Guest
27th August 2012, 14:16
Yes, individuals can purchase standards documents, but I work for a company that makes SOCs for set-top boxes and the company provides my access to them.