View Full Version : HowTo Edit H264/AVC TS Streams
Atak_Snajpera
23rd March 2007, 23:58
Does xport correct audio delay automatically?
drmpeg
24th March 2007, 01:36
Does xport correct audio delay automatically?
Yes. It discards all video up to the first I-frame. Then it saves the PTS of the first video frame (usually a B-frame). Based on that video PTS, the audio frames before that PTS are discarded.
So the audio delay should be near zero. Since the granularity of video and audio frames is different (33 ms for 30 fps video and 32 ms for AC-3 audio), there will still be a small residual audio delay.
C:\newmobcal>xport BBCHD1-DigiTV-2.ts 36932 1 1
xport Transport Stream Demuxer 0.94
program = 36932, video channel = 1, audio channel = 1
Program Number = 0 (0x0000), Program Map PID = 16 (0x0010)
Program Number = 36932 (0x9044), Program Map PID = 600 (0x0258)
Video PID = 1502 <0x05de>, type = 0x1b
ES descriptor for stream type 0x1b = 0x52, 0x01, 0x0b
Audio PID = 1505 <0x05e1>, type = 0x06
ES descriptor for stream type 0x06 = 0x0a, 0x04, 0x65, 0x6e, 0x67, 0x00
ES descriptor for stream type 0x06 = 0x6a, 0x01, 0x00
ES descriptor for stream type 0x06 = 0x52, 0x01, 0x08
Audio Bitrate = 384000, Audio Sampling Rate = 48000
Audio Mode = 3/2, bsid = 6, bsmod = 0
2 frames before first I-frame
High Profile
Level = 4.0
First Video PTS = 0x73b9d651
First Audio PTS = 0x73b9d4a5, -428
ts rate = 24128312
packets for pid 0 <0x0000> = 115, first = 924, last = 183815
packets for pid 16 <0x0010> = 1, first = 110209, last = 110209
packets for pid 17 <0x0011> = 8, first = 6940, last = 160954
packets for pid 20 <0x0014> = 2, first = 65063, last = 126381
packets for pid 600 <0x0258> = 115, first = 1533, last = 184424
packets for pid 1502 <0x05de> = 156419, first = 1, last = 184510
packets for pid 1505 <0x05e1> = 3235, first = 38, last = 184509
packets for pid 8191 <0x1fff> = 24616, first = 6, last = 184511
coded frames = 0, video fields = 0
C:\newmobcal>
So in the above sample, 2 video frames were discarded before the first I-frame. The first Video PTS was 0x73b9d651 and the audio was cut to the the audio frame that had PTS 0x73b9d4a5. The residual delay is -428, which is in 90 kHz ticks. To convert to milliseconds, divide by 90.
Ron
Atak_Snajpera
24th March 2007, 08:08
thanks!
Hironimo
13th April 2007, 16:12
Hi there.
I'm trying to process some of my captured h.264 .ts files.
First thing i noticed is that xport crashes.
drmpeg provided a fix (some unsual .ts stream, possibly normal for the Pro 7 and Sat.1 HD channels) - i will test that soon, dont know if that fix is public yet.
So I used mencoder temporarily and managed to convert the output to an avi.
What I noticed however is that when I re-derive the keyframes with virtualdub(mod) the resulting video is much less usable. I get far better results by opening the seperate output files (4 of them as there is about 7gb of video data) using the append segment function and save it to a single avi.
Please note however that VirtualDubMod seemes to have a bug that does not do the appending correctly (adds more data then there actually is), so I had to use the convential VirtualDub.
Once I had an avi I tried to work with it, but the ffdshow decoder does not decode it particularly well (even though the later versions do a better job). It decodes many frames incorrectly and even crashes, taking virtualdub with it.
See here (http://forum.doom9.org/showthread.php?t=124674) for details.
The other problem I have is the audio - it starts with a few seconds of stereo and then continues with 5.1 channels (except for the advertisements that are in stereo again).
This apparently causes VirtualDubMod to detect the bitrate and length of the audio incorrectly.
I just wanted to let you guys know of my experience, as some might find it helpful (see the info on the append segement and the re-derival of the keyframes).
Maybe someone even has info on how I can get rid of the problemlems described?
Kandor
13th April 2007, 19:32
Hi
I am reading through this thread as I find it intresting.
But what I can not understand is why are we not just using DGindex for demuxing the audiotrack?
The video demuxing and converting to avi I find very usefull, but what about the AC3 demuxing? would´t DGindex give the correct delay value and everything?
I can not try this by my self as I don´t have any .ts sources with h.264 and will most probebly not ever have because I will probebly not subscribe on any tv channels in the future.
But I find it allways interesting to figure out things.
Best regards
Kandor
Recently I tried to add a second language track to a TS file containing H264/AVC Video and AC3 audio. It proved more difficult than I thought. I came up with the following solution. Most parts are collected from some thread in this forum, so credits go to the original posters.
1. Demuxing TS:
Extract the video to RAW H264 and AC3 audio. I used mencoder for this. I used the version from 31.07.2006 from here: http://tirnanog.fate.jp/mirror/mplayer/
The latest official release didn't work
To demux video use the following command:
mencoder.exe "Z:\Infile.ts" -of rawvideo -ovc copy -oac copy -noskip -o Y:\Outfile.264
Demux audio using ProjectX (http://www.lucike.info/page_projectx.htm). This has the advantage that you see stream errors in the log. ProjectX will complain a lot about GOP size and won't extract the video track. It will extract all audio tracks and fix errors. I recommend recapping if you'll get errors as watching a file with errors is not much fun and synching the audio will be a pain in the ass. If you don't like ProjectX, you can still use
mencoder.exe "Z:\Infile.ts" -of rawaudio -ovc copy -oac copy -noskip -o Y:\Outfile.ac3
but you'll only get one audio track and no error report.
2. Put H264 into AVI:
AVC2AVI: (link see post from crypto)
avc2avi -i Y:\Outfile.264 -o Z:\Avifile.avi -c H264 -s 2000
Note: AVC2AVI doesn't like streams from BBCHD. Those are in 1440x1088 but AVC2AVI says 1440x1084 and will create one large avi which will require the fixing mentioned in Step 4 (look in section Obsolete). The original AVC2AVI reports 1440x540...
3./4. Removed
5. Add Audio:
You will most likely have to use a delay since the AV delay is not fixed when demuxing. The best thing is to add the audio multiple times with different delays and then see which is the best. You can also add more audio tracks here or cut unwanted parts. Save to a new AVI. Btw: I use VirtualDubMod for this.
6. (Optional) Convert to MKV:
AVI and H264/AVC isn't the best combination, so you may want to use MKV instead of AVI. Use MKVToolnix to create the MKV. You'll have to add the option "--engage allow_avc_in_vfw_mode". The resulting file may already work, it did half the time here. Better also do the following: Open the MKV in AVIMux GUI and save to a new MKV.
Obsolete (were necesary if you use original AVC2AVI from http://forum.doom9.org/showthread.php?t=89979):
3. Change the resolution:
The AVI will have a resolution of 1920x544 instead of 1920x1088. Use a hex editor to change the third occurence of 2002 to 4004.
4. Fix AVI File:
Open the AVI in VirtualDubMod, choose "Ask for extended options after this dialog", then choose "Re-derive keyframe flags".
It will take a looooong time till it's finished. Save the file with direct stream copy to a new avi, so you won't have to do the rekeying again if something goes wrong later. Note that VirtualDub most likely will display a lot of garbage when seeking but the resulting file will play fine
Obsolete (alternate demux commands, didn't work properly once, so I'm using the ones mentioned above):
1. Demuxing TS:
mplayer -dumpvideo -dumpfile Y:\Outfile.264 Z:\Infile.ts
mplayer -dumpaudio -dumpfile Y:\Outfile.ac3 Z:\Infile.ts
Hironimo
13th April 2007, 19:51
will probebly not subscribe on any tv channels in the future
Not subscribe? You mean pay-tv?
There are a few hdtv channels availably freely.
All you need is the appropriate reception and hardware, which you can get around 100 bucks.
D-Train
11th May 2007, 20:54
I've read this thread a few times and have had some success. I have a few questions too.
The video I'm trying to edit is a "raw" transport stream, 1440x1080i @29.97fps PAFF encoded, from Dish Network Universal HD.
So far I have been able to edit this video using the following steps:
1) Use TsRemux.exe to create a new transport stream with PMT and PAT packets
2) Identify cut points using TS_Packet_Editor.exe
3) Using cut points make part1.ts, part2.ts, etc.
4) Remux files into mkv using h264tsto.exe
5) Join part1.mkv, part2.mkv, etc. using AVIMux-GUI
The final file is great with the exception that the cut points are "dirty" and display artifacts. I'm sure it's that I'm not cutting on appropriate frames. I read that I want to identify and cut at IDR frames. How can I do this? Is this something I can identify from h264_parse output?
Originally, when cutting I used TSPE which cuts based on byte marks. I found that the audio and video PTS times drift at points and I wasn't getting clean cuts. Here's an xport output from a small section, notice the difference in PTS?
xport Transport Stream Demuxer 0.95
program = 1, video channel = 1, audio channel = 1
Program Number = 1 (0x0001), Program Map PID = 16 (0x0010)
Audio PID = 4387 <0x1123>, type = 0x81
Video PID = 4386 <0x1122>, type = 0x1b
Video PTS(P) = 0xf2adffcc
Video PTS(P) = 0xf2ae05a9, 1501
Video PTS(P) = 0xf2ae1742, 4505
Video PTS(P) = 0xf2ae1d1f, 1501
Video PTS(P) = 0xf2ae51e9, 13514
Video PTS(P) = 0xf2ae57c6, 1501
Video PTS(P) = 0xf2ae3a73, -7507
Video PTS(P) = 0xf2ae4050, 1501
Audio PTS = 0xf2abf433, -223611853
Video PTS(P) = 0xf2ae2eb8, -4504
Video PTS(P) = 0xf2ae3495, 1501
Audio Bitrate = 384000, Audio Sampling Rate = 48000
Audio Mode = 3/2, bsid = 8, bsmod = 0
Video PTS(P) = 0xf2ae462e, 4505
Video PTS(P) = 0xf2ae4c0b, 1501
Video PTS(P) = 0xf2ae80d5, 13514
Video PTS(P) = 0xf2ae86b2, 1501
Video PTS(P) = 0xf2ae695f, -7507
Video PTS(P) = 0xf2ae6f3c, 1501
Video PTS(P) = 0xf2ae5da4, -4504
Video PTS(P) = 0xf2ae6381, 1501
Audio PTS = 0xf2ac2c73, 14400
Video PTS(P) = 0xf2ae751a, 4505
Video PTS(P) = 0xf2ae7af7, 1501
Video PTS(P) = 0xf2aeafc1, 13514
Video PTS(P) = 0xf2aeb59e, 1501
Video PTS(P) = 0xf2ae984b, -7507
Video PTS(P) = 0xf2ae9e28, 1501
Video PTS(P) = 0xf2ae8c90, -4504
Video PTS(P) = 0xf2ae926d, 1501
Video PTS(P) = 0xf2aea406, 4505
Audio PTS = 0xf2ac64b3, 14400
Video PTS(P) = 0xf2aea9e3, 1501
Video PTS(P) = 0xf2aedead, 13514
Video PTS(P) = 0xf2aee48a, 1501
Video PTS(P) = 0xf2aec737, -7507
Video PTS(P) = 0xf2aecd14, 1501
Video PTS(P) = 0xf2aebb7c, -4504
Video PTS(P) = 0xf2aec159, 1501
Video PTS(P) = 0xf2aed2f2, 4505
Video PTS(P) = 0xf2aed8cf, 1501
Video PTS(P) = 0xf2af0d99, 13514
Audio PTS = 0xf2ac9cf3, 14400
Video PTS(P) = 0xf2af1376, 1501
Video PTS(P) = 0xf2aef623, -7507
Video PTS(P) = 0xf2aefc00, 1501
Video PTS(P) = 0xf2aeea68, -4504
Video PTS(P) = 0xf2aef045, 1501
Video PTS(P) = 0xf2af01de, 4505
Video PTS(P) = 0xf2af07bb, 1501
Video PTS(P) = 0xf2af3c85, 13514
44 frames before first I-frame
Main Profile
Level = 4.0
Audio PTS = 0xf2acd533, 14400
Video PTS(P) = 0xf2af4262, 1501
First Video PTS = 0xf2af3c85
Video PTS(P) = 0xf2af250f, -7507
Video PTS(P) = 0xf2af2aec, 1501
Video PTS(P) = 0xf2af1954, -4504
Video PTS(P) = 0xf2af1f31, 1501
Audio PTS = 0xf2ad0d73, 14400
Video PTS(P) = 0xf2af30ca, 4505
Video PTS(P) = 0xf2af36a7, 1501
Video PTS(P) = 0xf2af6b71, 13514
Video PTS(P) = 0xf2af714e, 1501
Audio PTS = 0xf2ad45b3, 14400
Video PTS(P) = 0xf2af53fb, -7507
Video PTS(P) = 0xf2af59d8, 1501
Video PTS(P) = 0xf2af4840, -4504
Video PTS(P) = 0xf2af4e1d, 1501
Video PTS(P) = 0xf2af5fb6, 4505
Video PTS(P) = 0xf2af6593, 1501
Audio PTS = 0xf2ad7df3, 14400
Video PTS(P) = 0xf2af9a5d, 13514
Video PTS(P) = 0xf2afa03a, 1501
Video PTS(P) = 0xf2af82e7, -7507
Video PTS(P) = 0xf2af88c4, 1501
Video PTS(P) = 0xf2af772c, -4504
Audio PTS = 0xf2adb633, 14400
Video PTS(P) = 0xf2af7d09, 1501
Video PTS(P) = 0xf2af8ea2, 4505
Video PTS(P) = 0xf2af947f, 1501
Video PTS(P) = 0xf2afc949, 13514
Video PTS(P) = 0xf2afcf26, 1501
Video PTS(P) = 0xf2afb1d3, -7507
Audio PTS = 0xf2adee73, 14400
Video PTS(P) = 0xf2afb7b0, 1501
Video PTS(P) = 0xf2afa618, -4504
Video PTS(P) = 0xf2afabf5, 1501
Video PTS(P) = 0xf2afbd8e, 4505
Video PTS(P) = 0xf2afc36b, 1501
Video PTS(P) = 0xf2aff835, 13514
Audio PTS = 0xf2ae26b3, 14400
Video PTS(P) = 0xf2affe12, 1501
Video PTS(P) = 0xf2afe0bf, -7507
Video PTS(P) = 0xf2afe69c, 1501
Video PTS(P) = 0xf2afd504, -4504
Video PTS(P) = 0xf2afdae1, 1501
Video PTS(P) = 0xf2afec7a, 4505
Video PTS(P) = 0xf2aff257, 1501
Video PTS(P) = 0xf2b02721, 13514
Audio PTS = 0xf2ae5ef3, 14400
Video PTS(P) = 0xf2b02cfe, 1501
Video PTS(P) = 0xf2b00fab, -7507
Audio PTS = 0xf2ae9733, 14400
Video PTS(P) = 0xf2b01588, 1501
Video PTS(P) = 0xf2b003f0, -4504
Video PTS(P) = 0xf2b009cd, 1501
Video PTS(P) = 0xf2b01b66, 4505
Audio PTS = 0xf2aecf73, 14400
Video PTS(P) = 0xf2b02143, 1501
Video PTS(P) = 0xf2b0560d, 13514
Video PTS(P) = 0xf2b05bea, 1501
Video PTS(P) = 0xf2b03e97, -7507
Audio PTS = 0xf2af07b3, 14400
Video PTS(P) = 0xf2b04474, 1501
Video PTS(P) = 0xf2b032dc, -4504
Video PTS(P) = 0xf2b038b9, 1501
Video PTS(P) = 0xf2b04a52, 4505
Video PTS(P) = 0xf2b0502f, 1501
Video PTS(P) = 0xf2b084f9, 13514
Video PTS(P) = 0xf2b08ad6, 1501
Audio PTS = 0xf2af3ff3, 14400
First Audio PTS = 0xf2af34b3, -2002
Video PTS(P) = 0xf2b06d83, -7507
Video PTS(P) = 0xf2b07360, 1501
Video PTS(P) = 0xf2b061c8, -4504
Video PTS(P) = 0xf2b067a5, 1501
Video PTS(P) = 0xf2b0793e, 4505
Video PTS(P) = 0xf2b07f1b, 1501
Video PTS(P) = 0xf2b0b3e5, 13514
Video PTS(P) = 0xf2b0b9c2, 1501
Video PTS(P) = 0xf2b09c6f, -7507
Video PTS(P) = 0xf2b0a24c, 1501
Video PTS(P) = 0xf2b090b4, -4504
Video PTS(P) = 0xf2b09691, 1501
Audio PTS = 0xf2af7833, 14400
Video PTS(P) = 0xf2b0a82a, 4505
Video PTS(P) = 0xf2b0ae07, 1501
Video PTS(P) = 0xf2b0e2d1, 13514
ts rate = 13237088
packets for pid 0 <0x0000> = 76, first = 294, last = 15820
packets for pid 16 <0x0010> = 76, first = 295, last = 15821
packets for pid 4386 <0x1122> = 15050, first = 1, last = 15926
packets for pid 4387 <0x1123> = 724, first = 23, last = 15909
coded frames = 0, video fields = 0
Are there any tools to cut based on PTS values? I experimented with modifying the xport code to do this and had some success.
Any pointers on how to edit this file? I feel like I'm so close to a perfect edit.
DreckSoft
18th June 2007, 19:17
@crypto: Is it possible that AVC2AVI has problems with newer PremiereHD Streams? There is no keyframe in the entire end credits when watching the avi. That's a bit strange, I don't think Premiere would transmit several minutes without a keyframe.
crypto
19th June 2007, 07:00
@DreckSoft
Yes, there might be changes in the bitsteam. They have (probably) switched to the new Tandberg EN8090 encoder. I will check that. No key frames over such a long period are not possible. There seems to be a problem with the detection.
DreckSoft
29th June 2007, 12:35
I did some more testing.
First I thought there might be a problem with the detection of high profile. So i changed line 632 to
h->b_key = (nal->i_type == NAL_SLICE_IDR || (nal->i_type == NAL_SLICE));
(below //fix: key flags in high profile)
Now I get a lot more keyframes (they seem to be correct) but now I encounter a different problem I recently observed with BBCHD (High School Musical).
The resulting avi has a lot of distorted frames in VDub and the Video length doesn't match. Meaning if I use the raw 264 and the audio and mux it directly into MKV audio is sync. When muxing into AVI it isn't.
Theory: There's a problem with handling the high profile.
dukey
5th July 2007, 20:52
I cant get this xport program to work
Got some h264 .ts streams
doing this
C:\AltDvb\Records>xport "20070624_2000 BBC HD.TS" 1 1 1
xport Transport Stream Demuxer 0.96
program = 1, video channel = 1, audio channel = 1
Program Number = 0 (0x0000), Program Map PID = 16 (0x0010)
Program Number = 6903 (0x1af7), Program Map PID = 256 (0x0100)
Program Number = 6904 (0x1af8), Program Map PID = 257 (0x0101)
Program Number = 6940 (0x1b1c), Program Map PID = 258 (0x0102)
Program Number = 6945 (0x1b21), Program Map PID = 259 (0x0103)
packets for pid 0 <0x0000> = 2607, first = 71, last = 2917509
packets for pid 258 <0x0102> = 5212, first = 632, last = 2917088
packets for pid 2318 <0x090e> = 2836596, first = 1, last = 2917719
packets for pid 2319 <0x090f> = 73304, first = 27, last = 2917705
coded frames = 0, video fields = 0
But i just get 2 empty files
one called
bits0001.mpa
bits0001.mpv
The audio in the file is AC3 though not mpa
Hunstad
6th July 2007, 19:58
Dukey, have you read the xport readme.txt
The output files are always named bits0001.mpv for video and bits0001.mpa for audio
(note that bits0001.mpa can be an AC-3 file).
and
Usage is:
xport <-pavtdszgh> <infile> <program number> <video stream number> <audio stream number>
Try
xport "20070624_2000 BBC HD.TS" 6940 1 1
dukey
7th July 2007, 03:58
many thanks
I have tried using mencoder but could not solve video/audio sync problem:
Now I am trying xport and I got the video and audio demuxed:
But what do I do now?
I know what to do with the audio file but the video file is strange to me:
I would love to mux to a compliant mp4 file...
C:\xport>xport c:\test.ts 1 1 1
xport Transport Stream Demuxer 0.96
program = 1, video channel = 1, audio channel = 1
Program Number = 1 (0x0001), Program Map PID = 32 (0x0020)
Video PID = 5154 <0x1422>, type = 0x1b
Audio PID = 5155 <0x1423>, type = 0x81
1 frames before first I-frame
Main Profile
Level = 4.0
First Video PTS = 0xb6af099e
Audio Bitrate = 384000, Audio Sampling Rate = 48000
Audio Mode = 3/2, bsid = 8, bsmod = 0
First Audio PTS = 0xb6af09d5, 55
ts rate = 11083808
packets for pid 0 <0x0000> = 1, first = 1, last = 1
packets for pid 32 <0x0020> = 1, first = 2, last = 2
packets for pid 5154 <0x1422> = 131232, first = 3, last = 137400
packets for pid 5155 <0x1423> = 6166, first = 11, last = 137373
coded frames = 0, video fields = 0
DreckSoft
22nd July 2007, 16:15
I'm really out of options now. Currently nothing works with Premiere HD streams. I've created a new thread here:
http://forum.doom9.org/showthread.php?p=1026733
Hope someone has an idea.
georgekellerman
3rd August 2007, 00:55
I have a BBCHD problem with xport V0.96: When demuxing the BBCHD TS-file, the raw AVC video is fully there, but the audio file has 0kB. Other recordings, like Astra HD or Pro7, all work fine (video and audio). Is the BBCHD audio different? Why is that? Xport is such a great program, is there a solution to this?
drmpeg
3rd August 2007, 02:14
I have a BBCHD problem with xport V0.96: When demuxing the BBCHD TS-file, the raw AVC video is fully there, but the audio file has 0kB. Other recordings, like Astra HD or Pro7, all work fine (video and audio). Is the BBCHD audio different? Why is that? Xport is such a great program, is there a solution to this?
If you could upload a sample (10 megabytes or so) somewhere, I'd be happy to take a look at it.
Ron
georgekellerman
3rd August 2007, 03:57
Thanks so much for the offer. Please read my PM. :)
drmpeg
3rd August 2007, 05:41
Here's the fix:
http://www.w6rz.net/xport.zip
Make sure you clear your cache to get the latest file (files in the .zip should be dated 8/2/2007).
As it turns out, I had already looked at this problem. It has to do with the BBC putting AC-3 audio into MPEG-1 audio PES packets.
BTW, the correct command line for the sample is:
xport bbc_apr_2007.ts 6940 1 3
You have to chose audio track 3 to get to the correct audio PID.
Ron
georgekellerman
3rd August 2007, 10:56
Omg. I can't believe it. Thank you so much for this unbelievably fast fix. And also for the correct command line. :)
xport forever!
Atak_Snajpera
7th September 2007, 00:31
How to demux only audio with xport?
drmpeg
7th September 2007, 03:02
How to demux only audio with xport?
I've updated xport to version 0.98 for audio only demuxing.
http://www.w6rz.net/xport.zip
Audio only demuxing is accomplished by setting the video channel to zero. Like so:
xport clip.ts 1 0 1
Ron
Atak_Snajpera
7th September 2007, 22:37
It would be very useful if xport v1.00 could automatically demux first available video and audio stream or even everything at once.
Anyway thanks for update so quickly:)
mverta
19th September 2007, 04:31
I need to convert .ts to another format, too - actually eventually I need a progressive frame sequence, like .png's or .tga's...
But first, since I don't need it to play back, I don't need to edit it, and I don't need its audio... I just need the simplest, highest-quality transcoding from the .ts files to something I can work with, what's the best option for me? I want to stay as close to the source as possible...
Thanks,
_Mike
lcld
20th September 2007, 16:51
drmpeg, many thanks for xport! At last a tool that does properly what advertised.
I've spent hours to find a way to remux (possibly damaged) ts/avc/aac streams into matroska, and tried countless combinations involving vlc, mencoder, direct show and other free/proprietary tools.
Comments about a few tools :
I hate mplayer. This is just a big bugware. By the way, "mencoder.exe -of rawaudio -ovc copy -oac copy" doesn't work ("Too many audio packets in the buffer").
VLC is slightly better. If you want to create unreadable files, it is a perfect tool. I use it to extract the audio track, into a mp4 container :
vlc --sout "#std{access=file,mux=mp4,dst=audio.mp4}" --no-sout-video -I dummy input.ts
MP4Box. Ahem, how is it possible this tool is unable to mux a raw AVC stream properly ?? It marks all frames as key frames (it indexes them all) instead of I frames only :
Lot of waste space. Once remuxed into mkv, we get a huge cue section.
If you seek the video, the player displays anything until it encounters an I frame.
Difficult to cut the video at key frames after that.
If there an option, tell me. I didn't find one.
The Haali DS filters stops remuxing at 1000 frames. No idea why.
xport :
I use xport to extract elementary streams. mkvmerge accepts them :)
I have a feature request though : please add support for AAC.
In fact, I hope xport handles damaged streams properly and ensures extracted streams are kept synced.
It seems to work under Linux i386. I'll do more tests.
$ gcc -Wall xport.c
xport.c: In function ‘parse_mpeg2_video’:
xport.c:1095: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
xport.c:1096: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
xport.c:1175: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
xport.c:1372: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
xport.c: In function ‘parse_h264_video’:
xport.c:1506: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
xport.c:1506: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long unsigned int’
xport.c:1400: warning: unused variable ‘first’
xport.c: In function ‘parse_vc1_video’:
xport.c:1883: warning: format ‘%.3f’ expects type ‘double’, but argument 2 has type ‘long double’
xport.c:1931: warning: format ‘%.3f’ expects type ‘double’, but argument 2 has type ‘long double’
hmmm... It may bug on 64 bits arch.
bob0r
20th September 2007, 22:09
...
The Haali DS filters stops remuxing at 1000 frames. No idea why.
...
What version?
lcld
20th September 2007, 22:22
The last one: 1.7.189.11
The bug is the same with graphedit and gdsmux. A fraction of second after having started the process, it stops remuxing. It simply becomes idle and if I look at the destination directory, the output file doesn't exist. When I close the application, the file appears and is playable : 1000 frames / 40 seconds / ~ 6 MB.
I tried several input files.
drmpeg
21st September 2007, 01:48
drmpeg, many thanks for xport! At last a tool that does properly what advertised.
xport :
I use xport to extract elementary streams. mkvmerge accepts them :)
I have a feature request though : please add support for AAC.
In fact, I hope xport handles damaged streams properly and ensures extracted streams are kept synced.
It seems to work under Linux i386. I'll do more tests.
$ gcc -Wall xport.c
xport.c: In function ‘parse_mpeg2_video’:
xport.c:1095: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
xport.c:1096: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
xport.c:1175: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
xport.c:1372: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
xport.c: In function ‘parse_h264_video’:
xport.c:1506: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
xport.c:1506: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long unsigned int’
xport.c:1400: warning: unused variable ‘first’
xport.c: In function ‘parse_vc1_video’:
xport.c:1883: warning: format ‘%.3f’ expects type ‘double’, but argument 2 has type ‘long double’
xport.c:1931: warning: format ‘%.3f’ expects type ‘double’, but argument 2 has type ‘long double’
hmmm... It may bug on 64 bits arch.
The use of "long" is pretty superfluous in xport. You should be able to change all "unsigned long" variables to "unsigned int" and all "long double" variables to "double". However, "long long" variables are there for a reason (for 33-bit PTS values), so don't change them.
xport doesn't have a specific algorithm to keep the output files in sync (other than at the very beginning).
AAC is definitely doable. If you could post a short test stream somewhere, I can add AAC demuxing.
Ron
lcld
21st September 2007, 14:03
Here is an undamaged one: http://alainmuchembled.free.fr/Doom9/avc-aac.ts (100s / 20MB)
This is also testcase for other apps :
when remuxed to mp4 with vlc : the image is truncated (96px width) and the audio is garbage
too long for Haali : it stops at 40s
Haali doesn't see any audio track
Thunderbolt8
22nd September 2007, 10:14
The last one: 1.7.189.11
The bug is the same with graphedit and gdsmux. A fraction of second after having started the process, it stops remuxing. It simply becomes idle and if I look at the destination directory, the output file doesn't exist. When I close the application, the file appears and is playable : 1000 frames / 40 seconds / ~ 6 MB.
I tried several input files.
I recently had a similar problem. I had a hddvd with vc-1 codec remuxed into .ts and files were presplitted.
I wanted to change container to .mkv then, so I joined the .ts files together with tsremux, but gdsmux was unable to remux the vc-1 .ts into .mkv, it just went idle after 0,6%. cpu and hdd just stopped working, but the program didnt end or crash nor was any error message given. the output file was ~3-7mb of size and playback was possible with mpc.
drmpeg
24th September 2007, 05:40
Here is an undamaged one: http://alainmuchembled.free.fr/Doom9/avc-aac.ts (100s / 20MB)
This is also testcase for other apps :
when remuxed to mp4 with vlc : the image is truncated (96px width) and the audio is garbage
too long for Haali : it stops at 40s
Haali doesn't see any audio track
Just wanted to let you know that I downloaded the clip and I'm working on it. Unfortunately, I don't have the correct MPEG-4 specifications to completely decipher the AAC format contained in this bitstream.
The AAC bitstream appears to be SL-packetized since the PES header is 0x00, 0x00, 0x01, 0xfa, but the stream_id of 0x11 suggests ISO/IEC 14496-3 Audio with the LATM transport syntax as defined in ISO/IEC 14496-3 / AMD 1.
I need find a copy of both ISO/IEC 14496-1 and ISO/IEC 14496-3 and do some research, so stay tuned.
Ron
Lulle
21st October 2007, 08:46
Where can I find xport? I cant find it @ the webb.
I need to find the delay to my video/audio file so I can sync it right.
Can I do it with xport? or shod I use some other app?
drmpeg
21st October 2007, 12:01
Where can I find xport? I cant find it @ the web.
I need to find the delay to my video/audio file so I can sync it right.
Can I do it with xport? or should I use some other app?
It is here:
http://www.w6rz.net/xport.zip
It will cut the audio to match the first valid frame of video. That is, the delay will be near zero.
BTW, for lcld, the current version of xport (0.98a) will demux AAC audio. However, I'm not sure if the raw AAC will be useful for you.
Ron
Lulle
21st October 2007, 16:50
It is here:
http://www.w6rz.net/xport.zip
It will cut the audio to match the first valid frame of video. That is, the delay will be near zero.
BTW, for lcld, the current version of xport (0.98a) will demux AAC audio. However, I'm not sure if the raw AAC will be useful for you.
Ron
Okej nice, I live in .eu. So we got h.264 AVC hdtv here.
I just want the sync numbers to the audio.
I have converted it to .avi but I cant get the audio to sync without the delay numbers.
How do I type in xpot to just se the delay numbers?
lcld
21st October 2007, 17:47
How do I type in xpot to just se the delay numbers?Read post #68 (http://forum.doom9.org/showthread.php?p=931340#post931340).
BTW, for lcld, the current version of xport (0.98a) will demux AAC audio. However, I'm not sure if the raw AAC will be useful for you.Indeed :(
xport-0.98a does (almost) the same thing as 'mplayer -dumpaudio' and I don't know what to do with raw AAC.
Lulle
21st October 2007, 18:56
Read post #68 (http://forum.doom9.org/showthread.php?p=931340#post931340).
Indeed :(
xport-0.98a does (almost) the same thing as 'mplayer -dumpaudio' and I don't know what to do with raw AAC.
ok, but what do I write to get this up:
First Video PTS = 0x00025c1f
First Audio PTS = 0x00026bae, 1103
??
drmpeg
22nd October 2007, 01:26
Okay nice, I live in .eu. So we got h.264 AVC hdtv here.
I just want the sync numbers to the audio.
I have converted it to .avi but I cant get the audio to sync without the delay numbers.
How do I type in xport to just see the delay numbers?
I don't think xport will be useful for you. It doesn't report the delay, it removes it from the demuxed files. The numbers reported are just the residual delay left in the demuxed files.
When you convert to .avi, do you use a demuxer first, or does the conversion happen in one step?
Ron
Lulle
22nd October 2007, 07:44
I don't think xport will be useful for you. It doesn't report the delay, it removes it from the demuxed files. The numbers reported are just the residual delay left in the demuxed files.
When you convert to .avi, do you use a demuxer first, or does the conversion happen in one step?
Ron
I open the .ts file in ProjectX and take the audio file out.
Then I open the .ts file with my .avs file in vdub.
And then I convert it.
And then after that I sync the .avi file with the .ac3 file in nadube.
I dont mux it..
I have been using ptscalc2 before to get the dealy numbers, but now I get error message at all .ts files. dont know why. And I hav reinstalld it too. But still dosent work
drmpeg
23rd October 2007, 09:34
I open the .ts file in ProjectX and take the audio file out.
Then I open the .ts file with my .avs file in vdub.
And then I convert it.
And then after that I sync the .avi file with the .ac3 file in nadube.
I don't mux it..
I have been using ptscalc2 before to get the delay numbers, but now I get error message at all .ts files. don't know why. And I hav reinstalled it too. But still doesn't work
It's possible that xport might help since it could be aligning the audio to the same video frame that vdub is starting on. You should give it a try. Instead of demuxing the audio with ProjectX, use xport. The command line is:
xport clip.ts 1 1 1
The AC-3 audio will end up in a file called bits0001.mpa, which you can rename to .ac3 if you want.
If you have trouble with xport, post the output here and I'll help you out.
BTW, what's nadube? I did a search for it (both Google and here on doom9), but got nothing.
Ron
canTsTop
31st October 2007, 15:14
hello, i need some help please
i have TS (PAL) file with h264 video (PAFF) and mp2 audio
firs i demux TS with xport, then mux video to mp4 with yamb, yamb asks me fps of the video, i write 25.000. after that i create avs with FFmpegSource("myvideo.mp4"), load it with megui and analyze for deinterlacing, it says that my source is partially interlaced and it recommend to use Yadif(order=1).
then i encode that video it is longer duration than was in TS, i searched for reason for this and fount out that PAFF should be double fps (50.00 fps ?). i couldn't find solution for this problem. can anyone help me with this or point to right direction
thank you
(sorry for bad english)
LOP500
2nd December 2007, 23:57
xport SW_clip.ts 3306 1 1
xport Transport Stream Demuxer 1.00
program = 3306, video channel = 1, audio channel = 1
Program Number = 0 (0x0000), Program Map PID = 16 (0x0010)
Program Number = 1404 (0x057c), Program Map PID = 258 (0x0102)
Program Number = 3801 (0x0ed9), Program Map PID = 256 (0x0100)
Program Number = 3306 (0x0cea), Program Map PID = 257 (0x0101)
program descriptor = 0x09, 0x04, 0x0b, 0x00, 0xe0, 0x65
Video PID = 513 <0x0201>, type = 0x1b
Audio PID = 645 <0x0285>, type = 0x06
ES descriptor for stream type 0x06 = 0x0a, 0x04, 0x65, 0x6e, 0x67, 0x00
ES descriptor for stream type 0x06 = 0x6a, 0x01, 0x00
ES descriptor for stream type 0x04 = 0x0a, 0x04, 0x65, 0x6e, 0x67, 0x00
ES descriptor for stream type 0x06 = 0x59, 0x08, 0x73, 0x77, 0x65, 0x12, 0x00, 0
x01, 0x00, 0x01
ES descriptor for stream type 0x06 = 0x59, 0x08, 0x64, 0x61, 0x6e, 0x12, 0x00, 0
x01, 0x00, 0x01
ES descriptor for stream type 0x06 = 0x59, 0x08, 0x6e, 0x6f, 0x72, 0x12, 0x00, 0
x01, 0x00, 0x01
ES descriptor for stream type 0x06 = 0x59, 0x08, 0x66, 0x69, 0x6e, 0x12, 0x00, 0
x01, 0x00, 0x01
Audio Bitrate = 384000, Audio Sampling Rate = 48000
Audio Mode = 3/2, bsid = 6, bsmod = 0
8 frames before first I-frame
High Profile
Level = 4.0
First Video PTS = 0xac4c788c
First Audio PTS = 0xac4c73b0, -1244
ts rate = 19996888
packets for pid 0 <0x0000> = 44, first = 2467, last = 120545
packets for pid 257 <0x0101> = 43, first = 310, last = 119492
packets for pid 513 <0x0201> = 117810, first = 1, last = 121868
packets for pid 604 <0x025c> = 45, first = 60193, last = 69854
packets for pid 605 <0x025d> = 54, first = 59317, last = 70310
packets for pid 606 <0x025e> = 56, first = 59135, last = 70324
packets for pid 607 <0x025f> = 57, first = 59151, last = 70336
packets for pid 644 <0x0284> = 1513, first = 14, last = 121830
packets for pid 645 <0x0285> = 2246, first = 2980, last = 121863
coded pictures = 210, video fields = 0
When testing with BSPlayer, the sound seems to be right( 7 seconds long). The problem is the video. Video seems to last longer than it should(=29 seconds)
The clip is 7 seconds long. It can be found here. (http://koti.mbnet.fi/lop/video/SW_clip.ts)
Thanks already.
drmpeg
3rd December 2007, 14:56
xport SW_clip.ts 3306 1 1
xport Transport Stream Demuxer 1.00
8 frames before first I-frame
coded pictures = 210, video fields = 0
When testing with BSPlayer, the sound seems to be right (7 seconds long). The problem is the video. Video seems to last longer than it should(=29 seconds)
Thanks already.
It's not an xport problem. xport is reporting 210 coded pictures (actually, there's 210 - 8 coded pictures in the demuxed elementary stream since xport discards the frames before the first I-frame). This is an MBAFF stream at 25 fps, so 202 / 25 = 8.08 seconds (there's always a little more video in a demuxed Transport Stream due to T-STD buffer requirements).
Ron
LOP500
3rd December 2007, 17:33
It's not an xport problem. xport is reporting 210 coded pictures (actually, there's 210 - 8 coded pictures in the demuxed elementary stream since xport discards the frames before the first I-frame). This is an MBAFF stream at 25 fps, so 202 / 25 = 8.08 seconds (there's always a little more video in a demuxed Transport Stream due to T-STD buffer requirements).
Ron
So in this case video should be 29 seconds and audio 7 seconds? Sounds very odd. I thought that audio and video should be same length after demux if I'm going to proceed to the next step. :)
I tried xport before with Mpeg2 HD clip. Both audio and video was same length after the demux. Now I only have h264 material and it would be nice to demux these also with xport.
So is there any way to fix my "problem"?
drmpeg
3rd December 2007, 17:48
So in this case video should be 29 seconds and audio 7 seconds? Sounds very odd. I thought that audio and video should be same length after demux if I'm going to proceed to the next step. :)
I tried xport before with Mpeg2 HD clip. Both audio and video was same length after the demux. Now I only have h264 material and it would be nice to demux these also with xport.
So is there any way to fix my "problem"?
I think you misunderstood my post. There is only 8.08 seconds of video in that clip. If there's a problem, it's with BSPlayer.
Ron
LOP500
3rd December 2007, 18:08
I think you misunderstood my post. There is only 8.08 seconds of video in that clip. If there's a problem, it's with BSPlayer.
Ron
Okay, my bad. I'll try to test it with some different software.
EDIT:
Yep, 29 seconds according to windows media player too but the video stops actually after 7 seconds. I guess there's a codec or something making these 22 fake seconds.
Strange that when opening xport demuxed file in Gordian Knot, it still shows these empty frames in the end of file.
EDIT2: Hmmmz, it's impossible to encode to another format because of these empty frames in the end. Maybe I should try to delete(=cut) the empty part.
drmpeg, which software do you use to play/handle mpv files?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.