View Full Version : I'm stuck. H.264 TS woes :(
oddball
6th November 2006, 02:00
I have spent the better part of the day trying to figure out how I can demux .TS files encoded with H.264 video and transcode it to something else (Like XviD for example).
I am totally stumped. I have been unable to demux it other than with TSConverter but it leaves me with a video file with a .RAW extension that is unplayable except in MPC when renamed to .H264
I can run it through AVC2AVI (Once renamed to .H264) but AVC2AVI seems to have a 2GB file limit and each AVI loaded into VirtualDub has to be 'fixed' by rekeying the keyframes.
Surely there is some method to get a H.264 .TS to XviD or x264 in a few simple steps?
I have CoreAVC installed and ffdshow set to H.264 for vfw plus Haali Matroska splitter.
crypto
6th November 2006, 07:14
I can run it through AVC2AVI (Once renamed to .H264) but AVC2AVI seems to have a 2GB file limit and each AVI loaded into VirtualDub has to be 'fixed' by rekeying the keyframes.
Provided you are not talking about BBC HD, you can use the modified AVC2AVI_MOD (http://forum.doom9.org/showthread.php?p=866145#post866145) which handles large files and keyframe flags. BBC uses high profile which currently does not work.
Pookie
6th November 2006, 09:23
Try:
ffmpeg.exe -i "input.ts" -threads 1 -benchmark -vcodec xvid -b 3000 -an -y "output.avi"
ffmpeg.exe -i "input.ts" -acodec mp3 -ab 320 -ac 2 -vn -y "output.mp3"
2-Pass
ffmpeg.exe -i "input.ts" -threads 1 -pass 1 -vcodec xvid -an -y "Discard.avi"
ffmpeg.exe -i "input.ts" -threads 1 -pass 2 -vcodec xvid -minrate 1500 -b 2000 -maxrate 3000 -an -y "Output.avi"
del Discard.avi
Tested it with this version:
http://tirnanog.fate.jp/mirror/ffmpeg/ffmpeg.rev6199.7z
I think transcoding the A/V separately might reduce sync problems. You'll have to mux with Vdub, or AvimuxGui, or...
oddball
6th November 2006, 11:16
Yes it is BBC HD
oddball
6th November 2006, 11:53
ffmpeg works but even on 2 pass the output is block-o-vision. Suggested settings for a 1 hour video at 1440x1088?
Pookie
6th November 2006, 16:26
Yeah, bring the bitrate up, or downsize. 264 is going to have higher quality at a lower bitrate than XVID.
ffmpeg.exe -i "input.ts" -threads 1 -pass 1 -vcodec xvid -an -s 720x400 -y "Discard.avi"
ffmpeg.exe -i "input.ts" -threads 1 -pass 2 -vcodec xvid -minrate 1000 -b 2000 -maxrate 3000 -an -s 720x400 -y "Output.avi"
del Discard.avi
DarkZell666
6th November 2006, 18:29
I really love how this is cross-posted with a similar thread in the AVC subforum ... lol :p (http://forum.doom9.org/showthread.php?t=117914&goto=newpost)
I'm also not surprised to see two cmdline based solutions to the same problem wicked problem XD
Long live CLI apps ^^
Pookie
6th November 2006, 21:18
Good one, DarkZell. I was just about to look at the syntax for mencoder to try the same thing :D
Here's an attempt at mencoder for Xvid
mencoder.exe -vf-clr -pp 0 -tsprog 0 -sws 9 -ovc xvid -xvidencopts vhq=3:bitrate=4000:nopacked:trellis:nogmc:noqpel:nocartoon:bvhq=0:max_bframes=2:quant_type=mpeg:pass=1 -nosound -o "input.avi" "input.ts"
mencoder.exe -vf-clr -pp 0 -tsprog 0 -sws 9 -ovc xvid -xvidencopts vhq=3:bitrate=4000:nopacked:trellis:nogmc:noqpel:nocartoon:bvhq=0:max_bframes=2:quant_type=mpeg:pass=2 -nosound -o "input.avi" "input.ts"
sjchmura
6th November 2006, 21:34
So for BBC stuff, what is the best tool to demux to raw h264 and Ac3 (and get the delay correct)???? so we can "transcode" with x264 and megui etc :)
Pookie
6th November 2006, 21:45
Dunno. That BBC material is nutty. You could try:
mplayer -dumpvideo -dumpfile clip.264 input.ts
mplayer -dumpaudio -dumpfile clip.ac3 input.ts
Inspired by this thread: http://forum.doom9.org/showthread.php?t=110312
Edit: The above didn't work with my sample TS file. Perhaps the version of Mplayer?
xporthdmv.exe input.ts 111 might be an option, but it didn't seem to like the source file either.
I'm using http://www.giusberto.ch/hdtv/BBC_H264_test6.ts to test
EDIT2: This Syntax seems to work (but I don't have a clip with dialogue to see if the A/V sync works)
mplayer -dumpvideo -vid 0x90e -dumpfile clip.264 input.ts
mplayer -dumpaudio -aid 0x910 -dumpfile clip.ac3 input.ts
Found the PIDs by running mplayer -v -novideo input.ts
drmpeg
6th November 2006, 22:48
xporthdmv.exe input.ts 111 might be an option, but it didn't seem to like the source file either.
xporthdmv.exe is only for AVCHD .m2ts files.
Ron
drmpeg
6th November 2006, 22:50
So for BBC stuff, what is the best tool to demux to raw h264 and Ac3 (and get the delay correct)???? so we can "transcode" with x264 and megui etc :)
Could you try my command line demuxer? It is definitely trying to align the audio.
http://www.w6rz.net/xportdev.zip
Ron
Pookie
7th November 2006, 00:11
xporthdmv.exe is only for AVCHD .m2ts files.
Ron
Aha. Good to know. Thanks.
Pookie
7th November 2006, 17:39
Here's a batch file to automate the process for testing.
Rename Your Transport Stream File to Input.ts
REM Demux the Transport Stream Source
;
xport.exe input.ts 1 1 1
;
REM Convert h264 to AVI
;
avc2avi_mod.exe -f 25.0 -i bits0001.mpv -o out.avi
;
REM Create .AVS file for Transcoding
;
@echo off
echo. > process.avs
echo. >> process.avs
echo SetMemoryMax(256) >> process.avs
echo. >> process.avs
echo. >> process.avs
echo #Load Your Avisynth Plugins Here >> process.avs
echo. >> process.avs
echo. >> process.avs
echo DirectShowSource("out.avi") >> process.avs
echo. >> process.avs
echo. >> process.avs
echo AssumeFPS(25.0) >>process.avs
echo. >> process.avs
echo. >> process.avs
echo crop(0,0,0,-8) >> process.avs
echo. >> process.avs
echo. >> process.avs
echo BicubicResize(640,480) >> process.avs
echo. >> process.avs
echo. >> process.avs
;
REM Transcode to XVID
;
ffmpeg -i "process.avs" -threads 1 -benchmark -vcodec xvid -b 3500 -an -y "xvid.avi"
SeeMoreDigital
7th November 2006, 18:20
Dunno. That BBC material is nutty.
I'm using http://www.giusberto.ch/hdtv/BBC_H264_test6.ts to test I don't have any problems using the latest version of MP4Box with YAMB to de-mux this streams!
http://img111.imageshack.us/img111/5791/extractid3.png
Pookie
7th November 2006, 18:39
Cool :) Does it mux with A/V sync ? That's about the only uncertain portion of this exercise. I wish we had a clip with some dialogue going on.
The file sizes are slightly different between the two demuxers:
47,367KB bits0001.mpv
47,461KB input_pid2318.264
SeeMoreDigital
7th November 2006, 18:57
Does it mux back together with A/V sync ?Yes....
oddball
7th November 2006, 21:01
Some mod thinks I violated a rule. But to be honest I asked about transocoding H.264 in the AVC forum. *NOT* demuxing!
So to the mod please don't jump all over me for this. Thanks.
P.S. I got the answer I needed in the non-HD AVC forum anyhow before anyone mentioned Mplayer here.
SeeMoreDigital
7th November 2006, 21:04
In hind-sight it may have been better to merge your two threads together!
oddball
7th November 2006, 21:26
For some reason Mencoder is dropping out on one of my .TS transcodes about 30% through. I am going to demux it and try transcoding the video seperately. But is there a way to log errors? When it exits (I am running from a batch file) I do not see why it died.
EDIT: Yamb 1.6.0 does not like one of my .TS files. It says 'unsupported feature' when I open it.
Nevermind about the batch error thing. I was being dumb. Just type the batch at the command prompt rather than double clicking it (Duuh).
SeeMoreDigital
7th November 2006, 21:43
EDIT: Yamb 1.6.0 does not like one of my .TS files. It says 'unsupported feature' when I open it.I take it you are using YAMB 1.6.0 dated 2006-06-14 and this version (http://82.10.220.174/Uploaded_Files/Doom9_Forum_files/MP4Box_0.4.3_(2006-08-28).7z) of MP4Box?
Cheers
oddball
7th November 2006, 22:35
Ah that's why. Different MP4Box version. Thx.
EDIT: Yamb stalls at 4% of extracting a .TS file. No output files are created.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.