Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Hardware > Apple TV and Home Theater

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 19, 2008, 03:53 AM   #1
brc76
macrumors newbie
 
Join Date: Oct 2008
How to make CC on a win OS?

Hi all,
The ATV now supports CC (soft subs) - in a beta version I know - but still I'm interested in experimenting with it.

Whenever hearing about making CC I hear Muxo or Compressor which both are non-windows compatible afaik.

Anyone has a solution for embedding CC in my h264 when using a Win OS only?
I'm not buying a mac quite yet so that doesnt count for a valid solution

Any pointers are greatly appreciated as I have been unable to find anything on google that remotely solves my problem.

Kind regards
brc
brc76 is offline   0 Reply With Quote
Old Oct 19, 2008, 06:32 AM   #2
PluueeR
macrumors newbie
 
Join Date: Oct 2008
You can use MP4Box to import a ttxt file into your mp4 file:

MP4Box -add [ttxtfilepath]:lang=[yourlangcode] [path_to_a_valid_mp4_file]

You can convert a .srt file to .ttxt using:

MP4Box -ttxt [srtfilepath])

Afterwards you need to edit a your .mp4v (on Mac use Dumpster, I don't know about a Windows equivalant). Set moov..mdia.hdl.subType to sbtl. Now you have your subtitles on your Apple TV. However the top is cut off and just one line is displayed.
PluueeR is offline   0 Reply With Quote
Old Oct 20, 2008, 04:07 PM   #3
brc76
Thread Starter
macrumors newbie
 
Join Date: Oct 2008
Thanx for your reply - I was closer than I thought.

Here is what I've done so far
1) Converted to h264 from mkv
2) Extracted subs from original mkv with MKVExtractGUI that's based on mkvtoolnix (http://www.videohelp.com/tools/MKVExtractGUI)
3) Converted to ttxt via yamb that's based on mp4box (http://yamb.unite-video.com/)
4) added the ttxt stream to the container by using yamb
5) ensured that the extension was m4v and not mp4 (you can just rename to get the proper effect)
6) Used QT Atom Viewer (http://tsviatko.jongov.com/index_prj...timeviewer.htm) to determine my point of entry which you stated and is mentioned here http://hendrik.kaju.pri.ee/2008/08/2...tles-revealed/. The Atom viewer was veeery slow but it got it gave me a hex offset.
7) Used ultraedit (http://www.ultraedit.com/downloads/u..._download.html) to find the offset and change it to the correct value (text->sbtl). For future passes I think i will skip step 6 and just seach in the binary code for "text".
8) Tada... captions that can be switch on/off via QT (havnt tried it on my ATV yet though.

However...
- The language is listed as "unknown". How can one change that?
- The subtitle is located top left instead of bottom center. How to change that?
brc76 is offline   0 Reply With Quote
Old Oct 25, 2008, 03:57 PM   #4
brc76
Thread Starter
macrumors newbie
 
Join Date: Oct 2008
Did some more digging:

- The undefined language track was my own fault - I didnt explicitly select the language for the stream. When selecting this it worked like a charm.
However, when I try to insert 2 text streams by doing the same steps (listed above) I am only able to control 1 of the added streams. The second stream is not listed as a possible selection i QT but is still shown (as subs) all the time and hence I have 2 text streams displayed when I select the first one to be enabled in QT. I assumed that I was able to add more that one text stream.
Is this a known error or am I doing smth wrong?

- I still have position problems with the ttxt. I have played with the settings according to http://gpac.sourceforge.net/doc_ttxt.php but still no cigar. Is this a known error as well or have I forgotten smth obvious?

- I have tried to embed srt's instead of ttxt's but these show even bigger problems (very large text). Funny thing is that if I don't do the "text"->"sbtl" step the text looks acceptable and in the right position but with no QT enable/disable support. Which of srt or ttxt is the better choice when the final goal is ATV (in a future ATV update that supports CC correctly of course) - religion or ...?

Any inputs are very welcome - especially if the errors above are known errors and hence would be pointless to hunt down.

Kind regards
brc
brc76 is offline   0 Reply With Quote
Old Oct 26, 2008, 10:42 AM   #5
brc76
Thread Starter
macrumors newbie
 
Join Date: Oct 2008
I've done some more testing

I've actually just tried to play the m4v on the ATV and here subs has the correct position when using ttxt's. It would seem that it is QT that is flawed in this equation. I can - as expected - switch the text stream on and off via the option menu on the ATV when playing the m4v.

Initially the subtitle looks as it should - no cut-off but just one line. I dont think it is a problem for me just yet because my test subject (The.Orphanage.2007.720p.BluRay.DTS.x264-ESiR.mkv) doesnt seem to have 2 liners any where (?). I must say I find it perfect until now.

Only thing left (just for the sake of completeness) is to obtain more text streams in same m4v (different languages) but my efforts has been in vain so far.

As always input is greatly appreciated.

Kind regards
brc
brc76 is offline   0 Reply With Quote
Old Nov 14, 2008, 05:42 PM   #6
FastJack42
macrumors newbie
 
Join Date: Nov 2008
Quote:
Originally Posted by brc76 View Post
- The subtitle is located top left instead of bottom center. How to change that?
You can alter the position of the subtitles in Quicktime. Select the track in Quicktime and then go to visual settings. There you can edit the offset of the subtitles. Though after saving the movie in Quicktime again you'll get a mov instead m4v file. (I still don't quite get the difference between those two)

There is a second way however. Edit it directly in Dumpster. The offset is stored in moov > trak > tkhd > matrix. In my example I set an offset of 158x500 for my movie. This resulted in the following values in the last line of the matrix: 0.0158, 0.0500, 0.01. You get the picture
FastJack42 is offline   0 Reply With Quote
Old Nov 15, 2008, 06:24 PM   #7
FastJack42
macrumors newbie
 
Join Date: Nov 2008
Actually looking at it again. You don't even need to set the position of the subtitles in Dumpster. The ttxt file contains the position too. Just look at the following code from my file:
Code:
<TextStreamHeader width="400" height="60" layer="0" translation_x="158" translation_y="500">
The translation parameters are already there. No need for Dumpster.

Now I wish there was a way to get rid of Dumpster altogether. Maybe dump the track as xml with mp4box, change its handler subtype to "sbtl" and then import those settings back into the movie file?
FastJack42 is offline   0 Reply With Quote
Old Nov 16, 2008, 09:09 AM   #8
brc76
Thread Starter
macrumors newbie
 
Join Date: Oct 2008
Thank you for your replies. I have - until now - concluded that things work fine on ATV but not so good in QT. Until those two handle text streams similar I wont do anything further.

However, I'm still investigating on how to embed more that 1 text stream in the m4v container but havnt been able to do so. Any pointers on this issues would be very welcome... and please remember that everything has to be done on a Win OS platform.

Kind regards
brc
brc76 is offline   0 Reply With Quote
Old Nov 16, 2008, 01:14 PM   #9
FastJack42
macrumors newbie
 
Join Date: Nov 2008
Basically there is no limit for the number of subtitle tracks. You can use MP4Box to add a bunch of subtitles. Just indicate the language of the subtitle with the three letter country code (use MP4Box -languages to get a list of the supported country codes). Then change the handler subtype of the tracks from text to sbtl.
Since you most probably want to see only one subtitle track at the same time you need to put them all in the same alternate group. You'll find the "alternateGroup" in each tracks header (moov/trak/tkhd). Each alternate group is just a unique value inside the movie. Since alternate group 1 is usually taken by alternate audio tracks you can take alternate group 2. Just put the same value into all subtitle tracks alternate groups.
That's it. This should work on Windows as well as on Mac OS X. The only difference is how you edit the QT atoms. On Mac OS X you can do that with Dumpster (that's what I'm using). On Windows you can do that with QT Atom Viewer and a hex editor.
I only tried playing that movie on my Mac in Quicktime since I don't have an Apple TV. It works fine on the Mac. I suppose that later firmware upgrades for the Apple TV will fix the subtitle problem you described earlier in this thread.
FastJack42 is offline   0 Reply With Quote
Old Jan 4, 2009, 10:29 AM   #10
brc76
Thread Starter
macrumors newbie
 
Join Date: Oct 2008
Better late that never - but I finally got around to test your suggestion.

You are indeed right! I changed the alternate group from 0 to 2 for both sbtl tracks and everything worked as it should! Thank You.

I desperately need dumpster for windows though (is such a project perhaps in the making somewhere?) the Atom viewer is not what I need and I found myself counting offset bytes based on the Movie Atoms documentation - way too error prone...

/brc
brc76 is offline   0 Reply With Quote
Old Jan 12, 2009, 06:36 PM   #11
eduo
macrumors member
 
Join Date: May 2002
Location: Mexico
Send a message via ICQ to eduo Send a message via AIM to eduo Send a message via Yahoo to eduo
Quote:
Originally Posted by FastJack42 View Post
Actually looking at it again. You don't even need to set the position of the subtitles in Dumpster. The ttxt file contains the position too. Just look at the following code from my file:
Code:
<TextStreamHeader width="400" height="60" layer="0" translation_x="158" translation_y="500">
The translation parameters are already there. No need for Dumpster.

Now I wish there was a way to get rid of Dumpster altogether. Maybe dump the track as xml with mp4box, change its handler subtype to "sbtl" and then import those settings back into the movie file?
Did you ever encounter a way to avoid Dumpster altogether? It's useless for automating processes, really.

Muxo is no help as its development has stopped and Handbrake has refused to accept the patches to include this in the program.

I assume either MP4Box or a modified AtomicParsley should be able to set this bit correctly (and I'm half thinking of traversing the sourcecode for mp4box to search for the ttxt atom and change it to sbtl and recompile, just to see how it goes).

Have you found anything on this front?
__________________
Eduo
eduo.info
gallery.eduo.info
eduo is offline   0 Reply With Quote
Old Jan 18, 2009, 06:29 AM   #12
brc76
Thread Starter
macrumors newbie
 
Join Date: Oct 2008
This was idd to be my next step. I havnt got around to reversing the code but it shouldt be too hard as the principle - as you state - is fairly simple.

This will be a long term project for me so dont expect anything too soon I will post any findings here none-the-less, I hopy equally minded will do the same.

/brc
brc76 is offline   0 Reply With Quote
Old Feb 2, 2009, 04:23 AM   #13
eduo
macrumors member
 
Join Date: May 2002
Location: Mexico
Send a message via ICQ to eduo Send a message via AIM to eduo Send a message via Yahoo to eduo
Well. I have tried.

I have traversed as best as I can the MP4Box code. I can't find which instance of "text" is the one that actually sets the atom's fourcc name.

Since using sed from the command line to replace all instances of "text" (or "0000text0000" if you want to play it safe) works to set all text tracks so they're recognized by apple programs and devices (except for the non-touch ipods) and pre-setting in the ttxt the correct width (full width of video) and height (20% of height of video) ends up giving perfect subtitles, changing that atom's fourcc from "text" to "sbtl" should be enough to create the track properly to begin with (instead of having to run the whole video through a search & replace routine).

I've gone and asked in the sf forums for MP4Box for help on where to locate this fourcc to change it in source and compile a personal version (as I only want to see the videos in Apple devices. I've also separately made a request for an "Apple Format" switch in the app itself. Seeing the activity of these forums I suspect none of these two will be answered.
__________________
Eduo
eduo.info
gallery.eduo.info
eduo is offline   0 Reply With Quote
Old Feb 23, 2009, 08:30 AM   #14
Justinb81
macrumors newbie
 
Join Date: Feb 2009
Location: The Netherlands
I am having some problems with using your sed method.
I am using the line:
sed s/0000text0000/0000sbtl0000/ <movie.m4v >movie_sub.m4v

But the resulting fille is unreadable by quicktime or dumpster.

I have also been trying to automate the encoding process, the sbtl part and the automatic positioning of the sub in the .ttxt is still giving me problems.
Justinb81 is offline   0 Reply With Quote
Old Feb 23, 2009, 02:47 PM   #15
eduo
macrumors member
 
Join Date: May 2002
Location: Mexico
Send a message via ICQ to eduo Send a message via AIM to eduo Send a message via Yahoo to eduo
Quote:
Originally Posted by Justinb81 View Post
I am having some problems with using your sed method.
I am using the line:
sed s/0000text0000/0000sbtl0000/ <movie.m4v >movie_sub.m4v

But the resulting fille is unreadable by quicktime or dumpster.

I have also been trying to automate the encoding process, the sbtl part and the automatic positioning of the sub in the .ttxt is still giving me problems.
I have been using sed for a while now, like this:

Code:
cat tmp_"$NEWFILE" |sed -e's/text/sbtl/g' > "$NEWFILE"
(part of a larger script I use, right after AtomicParsley and mp4box adding the sub.

I was documenting this yesterday here: http://forum.entropicgarden.com/view...p=15367#p15367

When I got a PM elsewhere pointing me to this: http://forum.doom9.org/showthread.php?t=145192

And then today I got another, to an open source muxo alternative: Subler.

http://forum.handbrake.fr/viewtopic.php?f=14&t=9197

So I'm a happy camper now.
__________________
Eduo
eduo.info
gallery.eduo.info
eduo is offline   0 Reply With Quote
Old Feb 23, 2009, 03:14 PM   #16
Justinb81
macrumors newbie
 
Join Date: Feb 2009
Location: The Netherlands
You Sir, are my hero!

I will pass on the subler way, because it uses a GUI.
But I will try to use the C code on my windows box.
The reason I want to use a Windows machine to encode is because my fastest Mac OS machine is a PowerMac G4 450dp and the Windows machine is a Core2Duo.
If there is an alternative to Vroksub (A subtitle downloader for opensubtitles.org) I want to switch the rest of the handling to my Mac machines.

This is what I have so far on my Windows Server (my Mac os knowledge isn't enough to come with a equivalent

------------------------
Convert.bat

::Set variables
set MP4BOX=d:\conversion\tools\MP4Box.exe
set VROKSUB=d:\conversion\tools\VrokSub.exe
set SED=d:\conversion\tools\sed\bin\sed.exe
set HANDBRAKE=d:\conversion\tools\HandBrakeCLI.exe
set WINRAR=C:\Progra~1\WinRAR\winrar.exe
set ATOMIC=d:\conversion\tools\AtomicParsley.exe



::Lock the conversion
IF EXIST d:\CONVERSION\lock.txt GOTO END
copy d:\CONVERSION\lockfile\lock.txt d:\CONVERSION\lock.txt



::Copy all Downloaded files and unpack the rars
::Move files to D:\downloaded\
D:\
MOVE D:\bittorrent\done\*.* D:\downloaded\
cd D:\downloaded\

::Unrar Downloaded files - var %%r and delete the rars
for /f %%r IN ('dir /b /s *.rar') do call start /wait cmd /c "%WINRAR% X -o+ %%r"
DEL /q /S *.r??
D:
cd D:\downloaded\

:elete the sample movies
del /s /q *sample*.*



::Sort movies by type
::Move The TV Shows into the conversion directory per show
for /f %%a IN ('dir /b /s *bones*.avi') do call start /wait cmd /c "move %%a D:\video\avi\tvshows\bones\unsubbed\"

::Move AVI files into the conversion directory
for /f %%b IN ('dir /b /s *.avi') do call start /wait cmd /c "move %%b D:\video\avi\unsubbed\"

::Move MKV files into the conversion directory
for /f %%c IN ('dir /b /s *.mkv') do call start /wait cmd /c "move %%c D:\video\mkv\unsubbed\"


::Find subtitles
::Find subtitles for the TV Shows
start /wait "%VROKSUB% "D:\video\avi\tvshows\bones\unsubbed" nl /move="D:\video\avi\tvshows\bones\subbed""

::Find subtitles for the avi's
start /wait "%VROKSUB% "D:\video\avi\unsubbed" nl /move="D:\video\avi\subbed""

::Find subtitles for the mkv's
start /wait "%VROKSUB% "D:\video\mkv\unsubbed" nl /move="D:\video\mkv\subbed""

::rename nl named files to usable files - var %%d
cd D:\video\
for /f %%d IN ('dir /b /s *.avi') do call start /wait cmd /c "rename %%~nd.nl.srt %%~nd.srt"



::Convert Srt to TTXT - var %%e %%f %%g
::Bones
cd D:\video\avi\tvshows\bones\subbed\
for /f %%e IN ('dir /b /s *.srt') do call start /wait cmd /c ""%MP4BOX%" -ttxt "%%e""
move *.ttxt e:\convert\tvshows\subbing\
DEL /q *.srt

::AVI
cd D:\video\avi\subbed\
for /f %%f IN ('dir /b /s *.srt') do call start /wait cmd /c ""%MP4BOX%" -ttxt "%%f""
move *.ttxt e:\convert\avi\subbing\
DEL /q *.srt

::MKV
cd D:\video\mkv\subbed\
for /f %%g IN ('dir /b /s *.srt') do call start /wait cmd /c ""%MP4BOX%" -ttxt "%%g""
move *.ttxt e:\convert\mkv\subbing\
DEL /q *.srt



::Conversion LOOP for Subtitled Movie files

:CONVERT
IF EXIST D:\video\avi\tvshows\bones\subbed\*bones*.avi GOTO BONES
IF EXIST D:\video\avi\subbed\*.avi GOTO AVI
IF EXIST D:\video\avi\subbed\*.avi GOTO MKV
IF EXIST D:\video\DVD\*.* GOTO DVD
DEL d:\CONVERSION\lock.txt
GOTO END






::Convert the TV Show Bones, Add iTunes Episode information and finish it

:BONES
::Handbrake converts SUBBED AVI to M4V without chapters - var %%a
d:
cd D:\video\avi\tvshows\bones\subbed\
for /f %%a IN ('dir /b *.avi') do call start /wait cmd /c ""%HANDBRAKE%" -i "%%a" -t 1 -c 1 -o "e:\convert\tvshows\subbing\%%~na.m4v" -f m4v -4 -X 960 -P -e x264 -q 0.59 -2 -T -a 1,1 -E faac,ac3 -B 160 -R 48,0 -6 dpl2,dpl2 -D 1,1 -x level=30:cabac=0:ref=3:mixed-refs=1:bframes=6:weightb=1:direct=auto:no-fast-pskip=1:me=umh:subq=7:analyse=all -v"
DEL /q *.*

::mux ttext into m4v - var %%h
e:
cd e:\convert\tvshows\subbing\
for /f %%h IN ('dir /b *.m4v') do call start /wait cmd /c ""%MP4BOX%" -add "%%~nh.ttxt":lang=nld "%%h""

::Rename TV Show to usable format
e:
CD e:\convert\tvshows\finished\
::Rename file for further processing - Bones.S04E14.HDTV.XviD-LOL.m4v to Bones-04-14.m4v
for /f "tokens=1,2,3,4* delims=.SE" %%a IN ('dir /b *.m4v') do rename %%a.S%%bE%%c.%%d*.m4v %%a-%%b-%%c.m4v
::Goto working directory
d:
CD e:\convert\tvshows\finished\
::Set iTunes Atoms
for /f "tokens=1,2,3 delims=-." %%a IN ('dir /b *.m4v') do %ATOMIC% %%a-%%b-%%c.m4v --stik "TV Show" --genre "TV Shows" --TVShowName "%%a" --TVSeasonNum "%%b" --TVEpisodeNum "%%c" --TVEpisode "%%b%%c" --artwork d:\conversion\art\bones\bones.jpg"
move *.m4v e:\convert\tvshows\finished\
DEL /q e:\convert\tvshows\subbing\*.*

GOTO CONVERT



:AVI
::Handbrake converts SUBBED AVI to M4V without chapters - var %%a
d:
cd D:\video\avi\subbed\
for /f %%a IN ('dir /b *.avi') do call start /wait cmd /c ""%HANDBRAKE%" -i "%%a" -t 1 -c 1 -o "e:\convert\avi\subbing\%%~na.m4v" -f m4v -4 -X 960 -P -e x264 -q 0.59 -2 -T -a 1,1 -E faac,ac3 -B 160 -R 48,0 -6 dpl2,dpl2 -D 1,1 -x level=30:cabac=0:ref=3:mixed-refs=1:bframes=6:weightb=1:direct=auto:no-fast-pskip=1:me=umh:subq=7:analyse=all -v"
DEL /q *.avi

::mux ttext into m4v - var %%i
e:
cd e:\convert\avi\subbing\
for /f %%i IN ('dir /b *.m4v') do call start /wait cmd /c ""%MP4BOX%" -add "%%~ni.ttxt":lang=nld "%%i""
move *.m4v e:\convert\avi\finished\
DEL /q e:\convert\avi\subbing\*.*

GOTO CONVERT



:MKV
d:
::Handbrake converts subbed MKV to M4V without chapters - var %%a
cd D:\video\mkv\subbed\
for /f %%a IN ('dir /b *.mkv') do call start /wait cmd /c ""%HANDBRAKE%" -i "%%a" -t 1 -c 1 -o "e:\convert\avi\subbing\%%~na.m4v" -f m4v -4 -X 960 -P -e x264 -q 0.59 -2 -T -a 1 -E faac -B 160 -R 48 -6 dpl2 -D 1 -x level=30:cabac=0:ref=3:mixed-refs=1:bframes=6:weightb=1:direct=auto:no-fast-pskip=1:me=umh:subq=7:analyse=all -v"
DEL /q *.mkv

::mux ttext into m4v - var %%j
e:
cd e:\convert\mkv\subbing\
for /f %%j IN ('dir /b *.m4v') do call start /wait cmd /c ""%MP4BOX%" -add "%%~nj.ttxt":lang=nld "%%j""
move *.m4v e:\convert\mkv\finished\
DEL /q e:\convert\mkv\subbing\*.*

GOTO CONVERT



VD
rem call start /wait d:\CONVERSION\BATCHFILES\DVD.BAT
GOTO CONVERT

:END
Justinb81 is offline   0 Reply With Quote
Old Apr 12, 2009, 08:13 AM   #17
brc76
Thread Starter
macrumors newbie
 
Join Date: Oct 2008
Thx for your replies - seems as if we are at the end of the road for now.

I have validated your findings and can now sum up :
- It is my experience that the new MP4box release writes sbtl instead of text so you dont have to do this step anymore
- It is my experience that you are required to change alternate group if you have more that one language track.

The executive summary on the original problem "how to make CC on a win OS?" will hence be:
  1. Produce target .m4v (via HB f.ex.)
  2. Isolate language track(s) in the .ttxt format (convert if necessary possibly via MP4Box)
  3. Add language track(s) to target via MP4Box (MP4Box.exe -add <mylang_laguagetrack>.ttxt:lang=<mylang> target.m4v). Run as many times as you have tracks
  4. If > 1 language track be sure to change alternate group to 2 which must be done for all language tracks - this is done manually (hex edit) until the tools can do it (or can they already?). If this is not done you can't toggle the different languges independently. How this is done is explained in the posts above

I'm looking forward to when HB will support it all - according to the roadmap it will be available in the next public release.
brc76 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Hardware > Apple TV and Home Theater

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Does Win 8.1 run cooler than Win 7? ilian92 Windows, Linux & Others on the Mac 5 Mar 17, 2014 11:33 PM
Win 8 to win 8.1 with boot camp again or to update? vigorito Windows, Linux & Others on the Mac 1 Dec 23, 2013 03:13 AM
How to make iso file from win 8 bootable files for bootcamp vigorito OS X 10.8 Mountain Lion 0 Dec 17, 2013 04:11 AM
How to Download Win 8.1 ISO with Win 8 Retail Key xcodeSyn Windows, Linux & Others on the Mac 2 Oct 22, 2013 10:06 PM
How to make the font size bigger under Win XP Mode on rMBP? deltauser Windows, Linux & Others on the Mac 1 Mar 19, 2013 11:25 AM

Forum Jump

All times are GMT -5. The time now is 05:49 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC