Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nateo200

macrumors 68030
Feb 4, 2009
2,906
42
Upstate NY
That is very well possible. And actually an option...



The interlacing should not have posed any problem. I've just played around with a few clips and am now pretty sure the file size was the problem. Seems like my little tool can't handle files that are too big. I'll try to find a way around it soon. Thanks for the hint though.

Good luck with your interlaced footage. Will it at least be played back on an interlaced TV screen? ;)
Yeah I figured it had to be a file size limit...I noticed that the file size of the .MOV created from the 5GB~ .MTS file stopped increasing after 3.99GB's. As for the delivery...SD DVD....man if this was HD delivery I might have cried because interlacing is disgusting looking....I went to my boss and explained that I had switched the camera to 30p from 60i...I made it very apparent that interlacing was ugly :D Gosh interlacing should be banned I tell you! Id rather shoot 1280x720p or even 960x540p than 1080i....this camera was particularly horrendous with the interlacing artifacts, I mean the edges of things standing still would spike, it was just awful. I hope I can deinterlace the footage before I deliver it...I don't care if it takes a bit longer!

Just another thought, at my workplace we now also have to handle AVCHD footage and in order to get them into Avid Media Composer 5.5.3..3, we open the .mts file in QT X and use the SAVE AS command (CMD+SHIFT+S) to save it as a .mov file, which then can be imported via AMA into MC. The same should be able via FCP X and that .mov file, though it might be a bit cumbersome to do so without a batch function. I just open six or so .mts files in QT X and use that CMD+SHIFT+S and Exposé to save as .mov and switch between windows and can get 30 videos done in less than five minutes (excluding the actual saving process).

These are the QT Components I have in my Macintosh HD / Library / QuickTime / folder, they can be downloaded in ten minutes from now (still uploading from an abysmal internet connection for ten or more people).
Thanks your very generous! Not sure if I have all of those but I downloaded anyways!

EDIT: Both of you have been VERY generous! Many times its easier to just walk away and I try my best to be the exception if I feel I can contribute effectively and I'm glad I see that in other users! Makes this smaller section nice :)
 
Last edited:

kalex

macrumors 65816
Oct 1, 2007
1,336
56
Hi. Just came across your program. Tried running it and keep getting errors trying to convert mkv files to m2ts files. Screenshot of error is attached. Any ideas?

tried it with 6 files I have and none of them were processed

thanks
 

Attachments

  • Screen Shot 2012-10-12 at 12.49.14 PM.png
    Screen Shot 2012-10-12 at 12.49.14 PM.png
    189.4 KB · Views: 267

floh

macrumors 6502
Original poster
Nov 28, 2011
460
2
Stuttgart, Germany
Hi. Just came across your program. Tried running it and keep getting errors trying to convert mkv files to m2ts files. Screenshot of error is attached. Any ideas?

tried it with 6 files I have and none of them were processed

thanks

Do you mind if I ask where the files originate from? The error message looks to me as if the original file actually is an H.264 codec, but the startcode (0x0000001) before the first keyframe is missing. This can happen if you for example record from a tivo or television in general and the recorder doesn't start at a proper point in the stream.

An .m2ts file is less relaxed when it comes to accepting streams than an .mkv file, it needs this keyframe information. Therefore just copying the stream results in an error. You will probably have to automatically add some information to the stream. This is kind of a re-encoding, but not really since you don't use quality. It is rather called re-muxing.

If you dare to use the Terminal in Mac OS, this might possibly be done if you type (or copy-paste) and adapt the following line into the Terminal:
Code:
/Applications/Video\ Container\ Switcher.app/Contents/Resources/ffmpeg -i /Volumes/.../inputfile.mkv -acodec copy -vcodec copy -bsf h264_mp4toannexb outputfile.m2ts
I hope that works. Sorry, but I won't include this in the program since it's a very specific case. If you need to do this more often, tell me and I'll consider it...
 

kalex

macrumors 65816
Oct 1, 2007
1,336
56
thanks for your help. these files were downloaded, not sure where they came from. basically what I'm trying to do is to convert stuff i download to m2ts format so that it plays fine via my windows media center extender. Extenders don't support mkv files natively

let me try in one file via terminal

----------

just tried coverting through terminal and it seemed to work fine. took less than 10 seconds

Code:
/Applications/Video\ Container\ Switcher.app/Contents/Resources/ffmpeg -i ~/Documents/test/Homeland\ -\ 2x01\ -\ 720p\ HDTV\ x264-EVOLVE.mkv -acodec copy -vcodec copy -bsf h264_mp4toannexb ~/Documents/test/homelandtest.m2ts
ffmpeg version 0.11.1-tessus Copyright (c) 2000-2012 the FFmpeg developers
  built on Aug 16 2012 18:49:35 with llvm_gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
  configuration: --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --disable-ffserver --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-fontconfig --enable-libfreetype --enable-libass --enable-filters --enable-runtime-cpudetect
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, matroska,webm, from '/Users/user1/Documents/test/Homeland - 2x01 - 720p HDTV x264-EVOLVE.mkv':
  Metadata:
    creation_time   : 2012-10-01 03:08:26
  Duration: 00:55:46.17, start: 0.000000, bitrate: 3243 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1280x720, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s (default)
[mpegts @ 0x102028400] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to '/Users/user1/Documents/test/homelandtest.m2ts':
  Metadata:
    creation_time   : 2012-10-01 03:08:26
    encoder         : Lavf54.6.100
    Stream #0:0(eng): Video: h264, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 90k tbn, 23.98 tbc (default)
    Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), 384 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=80226 fps=9570 q=-1.0 Lsize= 1481697kB time=00:55:46.00 bitrate=3627.6kbits/s    
video:1167297kB audio:156852kB global headers:0kB muxing overhead 11.897996%

anyway to automate this process?
 

floh

macrumors 6502
Original poster
Nov 28, 2011
460
2
Stuttgart, Germany
just tried coverting through terminal and it seemed to work fine. took less than 10 seconds
anyway to automate this process?

Well, yes, that's what I did with the program... ;)

Do you mean "automate" in a sense that it works from the Terminal? Or with a nice graphical interface? For the Terminal, I could write you a very simple script. If you know any bash scripting, this is very easy. A nice GUI took me a few hours the last time, and I don't really have too much free time right now (my first child was born 16 days ago... :) ).
 
  • Love
Reactions: LeadingHeat

Menneisyys2

macrumors 603
Jun 7, 2011
5,997
1,101
anyway to automate this process?

I've written one for you:

Code:
#!/bin/sh
for f in *.mkv; do Video\ Container\ Switcher.app/Contents/Resources/ffmpeg -i "$f"  -acodec copy -vcodec copy -bsf h264_mp4toannexb  "$f.m2ts"; done
(also available at https://dl.dropbox.com/u/81986513/102012/addAACtracktoMKVandMP4s/mkvtom2ts.sh )

NOTE:

1, it assues the MKV's to convert is in the current directory; as is Switcher.app

2, it only seems to be compatible with MP3 audio tracks. Of the (few) MKV files I've tested it, only converted the audio of MP3's and in no way the DTS / AC-3 tracks.
 

floh

macrumors 6502
Original poster
Nov 28, 2011
460
2
Stuttgart, Germany
I've written one for you:

Code:
#!/bin/sh
for f in *.mkv; do Video\ Container\ Switcher.app/Contents/Resources/ffmpeg -i "$f"  -acodec copy -vcodec copy -bsf h264_mp4toannexb  "$f.m2ts"; done
(also available at https://dl.dropbox.com/u/81986513/102012/addAACtracktoMKVandMP4s/mkvtom2ts.sh )

NOTE:

1, it assues the MKV's to convert is in the current directory; as is Switcher.app

2, it only seems to be compatible with MP3 audio tracks. Of the (few) MKV files I've tested it, only converted the audio of MP3's and in no way the DTS / AC-3 tracks.

Yeah, that's roughly how I would have gone about it, too. You could also make it a script to get a list of files to convert and an output directory as parameters if you need to do this more often.

For the guy asking: Do you have any idea how to make a bash script in Unix? If not, just pasting the second line (without the #!/bin/sh) into your Terminal will do exactly what he described: Take all the .mkv files in the current directory and convert them into the same directory.

The issue with AC-3 not being supported might actually stem from the ffmpeg version. I'm not sure which one you are using, but the GPL-version doesn't contain the AC3 codec...
 

kalex

macrumors 65816
Oct 1, 2007
1,336
56
Thank you floh and Menneisyys2 had a total brain fart. I can script it myself. i thought it would be easy to roll this into the ui but totally unnecessary

floh - congratulations. definitely no time with newborn
 

floh

macrumors 6502
Original poster
Nov 28, 2011
460
2
Stuttgart, Germany
i thought it would be easy to roll this into the ui but totally unnecessary

Yeah, it's not a lot of work to put this into the UI, but it is usually not needed and I try not to overload the tool. Keep it as simple as possible.

If you want to do it though, it is open source and very simply written. Just download the source code and add 2 lines or something to the code. I myself was really surprised how simple Cocoa programming is...
 

Menneisyys2

macrumors 603
Jun 7, 2011
5,997
1,101
Do you mind if I ask where the files originate from? The error message looks to me as if the original file actually is an H.264 codec, but the startcode (0x0000001) before the first keyframe is missing. This can happen if you for example record from a tivo or television in general and the recorder doesn't start at a proper point in the stream.

BTW, I've just published an article on this question, also linking to this thread. See https://forums.macrumors.com/showthread.php?p=16348503
 

Cox Orange

macrumors 68000
Jan 1, 2010
1,814
241
is this for PowerPC Macs??? The Link provided by floh does not give information, what the system specs have to be.
 

floh

macrumors 6502
Original poster
Nov 28, 2011
460
2
Stuttgart, Germany
is this for PowerPC Macs??? The Link provided by floh does not give information, what the system specs have to be.

I don't think it will run on PowerPC Macs. It's programmed for and on Intel Macs and uses the newer Frameworks of Mac OS. Principally, there should be nothing in MY part of the Objective-C code that would prevent it from running on PowerPC, but the Framework parts and included libraries will surely have some parts that rely on it. It will probably not even run on systems before Snow Leopard anymore.

Yeah, I just checked. I don't even have the option to build binaries for PowerPC on XCode 4.x anymore. Sorry, but I can't help you there.
 

MacSawdust

macrumors member
Jun 13, 2002
56
0
Chapter

Speaking of metadata, how about a tool to edit chapter titles without reencoding? It's worth $10 to me.
 

floh

macrumors 6502
Original poster
Nov 28, 2011
460
2
Stuttgart, Germany
Speaking of metadata, how about a tool to edit chapter titles without reencoding? It's worth $10 to me.

Yes, I'd pay for that, too. But it's much more programming effort because it needs a more extensive interface. So sadly I don't have the time to do it. But maybe someone else wants to?
 

MacSawdust

macrumors member
Jun 13, 2002
56
0
Bare Bones

Yes, I'd pay for that, too. But it's much more programming effort because it needs a more extensive interface. So sadly I don't have the time to do it. But maybe someone else wants to?

When you say Interface, you probably don't mean UI, but I'm just looking to change existing chapter names, not add additional chapters. Does that make it easier?
 

floh

macrumors 6502
Original poster
Nov 28, 2011
460
2
Stuttgart, Germany
When you say Interface, you probably don't mean UI, but I'm just looking to change existing chapter names, not add additional chapters. Does that make it easier?

Not really, sorry. But I'm fairly sure Subler can do this. Just open the file, click on the "Chapter Track" and double click on any chapter whose name you want to change...
 

SyberKnight

macrumors newbie
Dec 10, 2013
4
0
is this Mac app called "Video container switcher" @ https://sourceforge.net/projects/containerswitch still being maintained or is it dead?

i LOVE it in concept, but it's not working well for me (running on Mac Sierra 10.12.x).

it seems to do the job but upon playing back the resulting file, the audio is gone or it is out of sync or the video is too jittery to watch.

note, these results are trying to change a bunch of AVI to MP4.

thanks.
 

Unami

macrumors 65816
Jul 27, 2010
1,348
1,550
Austria
i use mp4tools, which can rewrap (and/or re-encode) h.264 files into an .mp4 container.
 

phrehdd

macrumors 601
Oct 25, 2008
4,311
1,311
Hey, I wasn't aware of this thread, it's certainly very helpful, thanks! But this shows that this question is asked frequently around here. :)



Preaching to the choir, my friend, I am the same way. I still do it sometimes if e.g. I do a very simple multicam edit without lots of effects. In this case, my hard drive bandwidth is sometimes harder on me than my CPU, so I leave the files H.264 encoded...

But (as you probably know) many people try to edit in H.264, and as you definitely know, many people mess up their AVCHD folder structure and are left with only the .MTS files. I just thought I could program an easy fix for this, and maybe it'll help some people...

By the way, it's great fun programming GUIs with XCode. I spent 5 hours in total on this project, including the learning of Objective-C.

Sadly, not a great deal of useful tools on the Mac side (especially free ones). On the Win side, there are excellent tools to deal with AVCHD that let you use the mpls file to put all the m2ts files in order and append them into one big file or if you want you can manually add each m2ts file (in proper order) and then "join" them. The software is called TSmuxer and its been around for a long while.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.