PDA

View Full Version : Mac: extracing VIDEO_TS audio; replacing VIDEO_TS audio?


cleantone
2007-10-12, 12:34 PM
Okay. I am hoping to figure out a way to demux audio from a DVD and then remux new audio back onto it without loosing video quality. I made a DVD of a VHS tape a while ago. The audio has a flaw. I can fix it and put the audio back on. The exact length and sync shouldn't change. I figure ffmegx should be able to make this happen. Anyone know?

ffooky
2007-10-12, 12:49 PM
I'd go with one of the demux options in the File menu of MPEG Streamclip (http://www.squared5.com/svideo/mpeg-streamclip-mac.html). If you open the first main VOB in a VIDEO_TS it'll give you the option of opening the whole set as one. Once you've made your corrections in the audio you could remux (as a VIDEO_TS folder) with ffmpegX or, as long as the audio and video streams are identically named apart from extension and in the same directory, you can use Toast.

U2Lynne
2007-10-12, 12:49 PM
You might want to take a look at this thread: http://www.thetradersden.org/forums/showthread.php?t=32975 There are some software links to applications to demux the DVD and remux new audio.

edit: And there goes ffooky replying first. How does he always get to these Mac threads so darned fast!?!?

cleantone
2007-10-12, 01:06 PM
Okay. I'll try that. It tells me I need to update my mpeg2 component or something. The link it gives me doesn't seem to work on apple.com though. Anyway, how do you open all of the VOB at once? I have a VIDEO_TS with 4 VOB's. It seems to open one at a time. Thanks for the help guys!

ffooky
2007-10-12, 01:34 PM
Yep, due to licensing reasons you have to buy/obtain the MPEG-2 component.

Right/control click on the first 1,024 meg VOB in your VIDEO_TS folder, select to open with MPEG Streamclip and then you'll be offered the choice of opening just that VOB or the whole VTS_0*.

cleantone
2007-10-12, 02:53 PM
Thanks! I got that part done. Now how do I remux? Do I need that mpeg2 thing to do that?

ffooky
2007-10-12, 03:01 PM
Thanks! I got that part done. Now how do I remux? Do I need that mpeg2 thing to do that?Not as far as I'm aware with ffmpegX but probably with Toast. There are other options at this point...MovieGate comes to mind...but give ffmpegX a bash first. You'll need to go the tools->mux option and then it will be obvious what to do. I'd advise selecting Open Terminal Window from the dropdown menu under ffmpegX in the menu bar, it helps when trying to find out what's gone wrong, if it does ;)

cleantone
2007-10-12, 03:27 PM
Thanks. I am working on it right now. It doesn't seem to want to take aiff so I am making an mp3 and I hope that will work and keep sync. I wasn't able to fine the terminal. I have version 0.0.9u.

ffooky
2007-10-12, 04:12 PM
Ah, I hadn't anticipated your using AIFF. Convert that to WAV with iTunes/QuickTime and ffmpegX will play nice and avoid a/nother lossy stage.

cleantone
2007-10-12, 04:39 PM
Okay. I am trying it with WAV right now. It looks to be making an .mp2 from the WAV file. I'll see if it works. Thanks for the help. I have to leave shortly.

cleantone
2007-10-12, 04:43 PM
I can't figure out why it says "unable to read from" on that folder. The permissions are okay for read and write. Any idea?

ffmpeg version CVS, build 3277056, Copyright (c) 2000-2004 Fabrice Bellard
Mac OSX static build for ffmpegX
configuration: --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
built on Dec 1 2005 03:50:24, gcc: 3.3 20030304 (Apple Computer, Inc. build 1666)
Input #0, wav, from '/Users/xxxxxxxx/Desktop/new soundtrack.wav':
Duration: 00:45:14.2, start: 0.000000, bitrate: 1535 kb/s
Stream #0.0: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
Output #0, mp2, to '/Users/xxxxxxxx/Desktop/new soundtrack.wav.mp2':
Stream #0.0: Audio: mp2, 48000 Hz, stereo, 224 kb/s
Stream mapping:
Stream #0.0 -> #0.0
video:0kB audio:74217kB global headers:0kB muxing overhead 0.000000%
INFO: [mplex] mplex version 2.2.2 ($Date: 2003/05/13 20:27:15 $)
**ERROR: [mplex] Unable to read from /Users/xxxxxxxx/Desktop/xxxxxxxx/VIDEO_TS.

ffooky
2007-10-12, 04:47 PM
Where is the relevant M2V file (as demuxed by MPEG Streamclip) located ?

cleantone
2007-10-12, 04:51 PM
On the desktop right now. That is where the WAV file was. Does it need to be in the VIDEO_TS folder?

ffooky
2007-10-12, 04:55 PM
Nope. In ffmpegX's mux tab you need to select the M2v as the video and your edited WAV as the audio. ffmpegX will create it's own VIDEO_TS folder (along with a muxed MPEG beforehand) in the same directory as the source files. For safety's sake it's probably a good idea to pop them in a directory of their own before muxing.

cleantone
2007-10-12, 05:03 PM
M2v? What is that? I need to bail in just a couple minutes. Thanks for the help!

googled:

Packetized Elementary Stream. It contains only video related data.

M2V files are normally destined to be multiplexed (muxed), which is the process of adding audio data and perhaps other streams such as subtitles, before use. M2Vs are created by demultiplexing (demuxing) an existing MPEG-2, or by converting another video format to MPEG-2.

The file extension M2V is mostly found with SFV Host Files.

So this is something I was supposed to make with mpeg streamclip? I'm on my way out. Hopefully we can pick this up tomorrow or another day. Thanks.

ffooky
2007-10-12, 05:08 PM
If you're trying to replace a VTS_* in a VIDEO_TS folder that has other VTS sets like a menu etc then you'll have to rename at least the VOBs created by ffmpegX to match the originals, maybe the VTS_0*_*.BUP/IFOs as well and try just dropping them into your original VIDEO_TS folder (saving the original VTS beforehand of course). I imagine that'll only work as long as the times/codecs of the replacements match the originals. If not then you'll have to try reconstructing the whole shebang with something like MovieGate.

ffooky
2007-10-12, 05:09 PM
Hopefully we can pick this up tomorrow or another day. Thanks.Yeah, no worries.

cleantone
2007-10-13, 03:03 PM
Thanks. The thing I am trying to do right now has no menu at all. It was from A VHS tape that I transfered. I since got rid of the VHS but noticed a flaw on the audio. I can fix it, and have done so. I just want to mux the new footage onto the footage without re-encoding the footage. I don't want to muck up the image quality doing this.

cleantone
2007-10-14, 09:46 AM
Hey! Hope your around today a bit. I have been trying to work this out again. In the "tools"/"mux" what do I need to be selecting in the video field? A "VOB"? The VIDEO_TS folder?

U2Lynne
2007-10-14, 10:29 AM
I'm not ffooky, and I could be way wrong, but after you demuxed, didn't you end up with an audio file (I think you are replacing this with wav or mp3, right?) and a video file (m2v)? So, when you want to mux the files back together, I would think you would pick the audio and video files.

cleantone
2007-10-14, 11:09 AM
I am pretty sure there was no M2V file. I have something else processing right now for a little bit. I'll have to redo it to remember for sure.

ffooky
2007-10-14, 11:17 AM
Hey cleantone, sorry, been away from my post for a bit. Yep, the luscious and pouting Lynne is bang on. You want to select the M2V file that you demuxed with MPEG Streamclip as the video and your fixed audio as the...errrr...audio. Let ffmpegX mux those suckers as a DVD (VIDEO_TS folder) and check that it plays OK with DVD Player or VLC before burning.

It's occurred to me that we didn't ask which audio codec was used for the original DVD. Open one of the original VOBs with Streamclip and select the get info option. The audio will be one of LPCM (basically the same as WAV/AIFF and, therefore, losslessly editable), MP2 or Dolby Digital/AC3. If it's either of the latter you'll have had to introduce a lossy stage when you decoded to WAV/AIFF and then re-encoded when muxing. There is an application called Fission which can edit MP3 files wihout re-encoding but I don't think it can handle MP2 and certainly not AC3/DD.

You can forget the original VIDEO_TS once you've demuxed it. All ffmpegX wants is the demuxed M2V and your fixed audio stream.

Depending on the size of the finished DVD you can keep the edited audio as a WAV/LPCM if you mux to DVD with Toast 7/8. For some stupid reason you achieve this by selecting Dolby Digital as the audio option (and rencode never as the video one) in the custom setting of the Video Tab. Obviously the audio stream of the DVD will be much larger than either MP2 or AC3 if they were used originally. If the source material used LPCM then this is obviously the preferable route to preserve audio quality. If the orig. used a lossy codec then the added size of the audio might mean you'll need to compress the video in order to fit on a DVD which is something you obviously want to avoid.

If your original DVD did use LPCM but you don't have/can't afford Toast then you might want to investigate MovieGate which I believe can produce DVDs with LPCM. I can't check as I'm on a Linux box at the moment (look at me Ma :) ) but I'll check later tonight if you're around.

Cheers, ff

cleantone
2007-10-14, 11:25 AM
The origional DVD was made with Toast a couple of years ago. The audio is LPCM. I am about 40% done on some processing of something else. I'll redo the demux and try to get that right. Thanks a ton!

ffooky
2007-10-14, 12:10 PM
No worries but make sure you set the custom settings right afore ye start Toast a creatin'. You need to make sure the M2V and fixed WAV are in the same folder and identically named other than extension. Choose the custom settings option, set re-encoding to Never and PCM for audio. It's PCM that acts as passthrough, not DD, my bad ;) If you see Toast say "encoding" rather than "mutliplexing" it probably means that you've gone wrong. Check in your Home folder/Documents/Roxio Encoded Items folder while it's running and check the extensions of any files being created in there.

U2Lynne
2007-10-14, 12:11 PM
Hey cleantone, sorry, been away from my post for a bit. Yep, the luscious and pouting Lynne is bang on.
I always knew there was a reason I liked you. :D

cleantone
2007-10-14, 01:14 PM
Oh okay. I had originally only done "demux to AIFF" now I see the "demux to M2V and AIFF" option. Should be able to take it from here! Thanks.

cleantone
2007-10-14, 02:42 PM
So I did a new mux. I used mpeg streamclip to demux a M2V. I then used ffmegx, tools, mux, selected the m2v in the video field, the fixed wav in the audio field. I selected "author as dvd", mux as dvd Sync 0.

The footage seems fine. The file size went from 3.09gb (original) to 2.58gb (new)

Mac DVD Bitrate Paranoia states the origional was 9.32mbps the new one is 7.96mbps

I also lost 10 chapter marks.

I would REALLY love to figure out how to do this with absolutely no loss in image quality. What do you think?

Here is the info... See anything odd?

ffmpeg version CVS, build 3277056, Copyright (c) 2000-2004 Fabrice Bellard
Mac OSX static build for ffmpegX
configuration: --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
built on Dec 1 2005 03:50:24, gcc: 3.3 20030304 (Apple Computer, Inc. build 1666)
Input #0, wav, from '/Users/*ommited*/Desktop/*ommited*/VTS_01_1.wav':
Duration: 00:45:14.2, start: 0.000000, bitrate: 1535 kb/s
Stream #0.0: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
Output #0, mp2, to '/Users/*ommited*/Desktop/*ommited*/VTS_01_1.wav.mp2':
Stream #0.0: Audio: mp2, 48000 Hz, stereo, 224 kb/s
Stream mapping:
Stream #0.0 -> #0.0
video:0kB audio:74217kB global headers:0kB muxing overhead 0.000000%
INFO: [mplex] mplex version 2.2.2 ($Date: 2003/05/13 20:27:15 $)
INFO: [mplex] File /Users/*ommited*/Desktop/*ommited*/VTS_01_1.m2v looks like an MPEG Video stream.
INFO: [mplex] File /Users/*ommited*/Desktop/*ommited*/VTS_01_1.wav.mp2 looks like an MPEG Audio stream.
INFO: [mplex] Video stream 0: profile 8 selected - ignoring non-standard options!
INFO: [mplex] Found 1 audio streams and 1 video streams
INFO: [mplex] Selecting dvdauthor DVD output profile
INFO: [mplex] Multiplexing video program stream!
INFO: [mplex] Scanning for header info: Video stream e0 (/Users/*ommited*/Desktop/*ommited*/VTS_01_1.m2v)
INFO: [mplex] VIDEO STREAM: e0
INFO: [mplex] Frame width : 720
INFO: [mplex] Frame height : 480
INFO: [mplex] Aspect ratio : 4:3 display
INFO: [mplex] Picture rate : 29.970 frames/sec
INFO: [mplex] Bit rate : 8000000 bits/sec
INFO: [mplex] Vbv buffer size : 229376 bytes
INFO: [mplex] CSPF : 0
INFO: [mplex] Scanning for header info: Audio stream c0 (/Users/*ommited*/Desktop/*ommited*/VTS_01_1.wav.mp2)
INFO: [mplex] MPEG AUDIO STREAM: c0
INFO: [mplex] Audio version : 1.0
INFO: [mplex] Layer : 2
INFO: [mplex] CRC checksums : no
INFO: [mplex] Bit rate : 28672 bytes/sec (224 kbit/sec)
INFO: [mplex] Frequency : 48000 Hz
INFO: [mplex] Mode : 0 stereo
INFO: [mplex] Mode extension : 0
INFO: [mplex] Copyright bit : 0 no copyright
INFO: [mplex] Original/Copy : 1 original
INFO: [mplex] Emphasis : 0 none
INFO: [mplex] SYSTEMS/PROGRAM stream:
INFO: [mplex] rough-guess multiplexed stream data rate : 8354048
INFO: [mplex] target data-rate specified : 10080000
INFO: [mplex] Setting specified specified data rate: 10080000
INFO: [mplex] Run-in Sectors = 89 Video delay = 13019 Audio delay = 16022
INFO: [mplex] New sequence commences...
INFO: [mplex] Video e0: buf= 237568 frame=000000 sector=00000000
INFO: [mplex] Audio c0: buf= 4096 frame=000000 sector=00000000
++ WARN: [mplex] Discarding incomplete final frame MPEG audio stream c0!
INFO: [mplex] Scanned to end AU 81345
INFO: [mplex] STREAM e0 completed @ frame 81345.
INFO: [mplex] STREAM c0 completed @ frame 113091.
INFO: [mplex] Multiplex completion at SCR=244281929.
INFO: [mplex] Video e0: buf= 55112 frame=081345 sector=01339544
INFO: [mplex] Audio c0: buf= 736 frame=113091 sector=00037623
INFO: [mplex] VIDEO_STATISTICS: e0
INFO: [mplex] Video Stream length: 2708182004 bytes
INFO: [mplex] Sequence headers: 5424
INFO: [mplex] Sequence ends : 1
INFO: [mplex] No. Pictures : 81345
INFO: [mplex] No. Groups : 5424
INFO: [mplex] No. I Frames : 5424 avg. size 72939 bytes
INFO: [mplex] No. P Frames : 21694 avg. size 33967 bytes
INFO: [mplex] No. B Frames : 54228 avg. size 29056 bytes
INFO: [mplex] Average bit-rate : 7982000 bits/sec
INFO: [mplex] Peak bit-rate : 7844800 bits/sec
INFO: [mplex] BUFFERING min 15 Buf max 134306
INFO: [mplex] AUDIO_STATISTICS: c0
INFO: [mplex] Audio stream length 75997828 bytes.
INFO: [mplex] Syncwords : 113093
INFO: [mplex] Frames : 113093 padded
INFO: [mplex] Frames : 0 unpadded
INFO: [mplex] BUFFERING min 15 Buf max 683
INFO: [mplex] MUX STATUS: no under-runs detected.
STAT: Picking VTS 01
STAT: Processing /Users/*ommited*/Desktop/*ommited*/VTS_01_1.mpg...
STAT: VOBU 16 at 7MB, 1 PGCS

*ommited*

STAT: VOBU 5424 at 2700MB, 1 PGCS
INFO: Video pts = 0.178 .. 2714.422
INFO: Audio[8] pts = 0.178 .. 2714.410
STAT: VOBU 5424 at 2700MB, 1 PGCS
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: ntsc
INFO: Aspect ratio: 4:3
INFO: Resolution: 720x480
INFO: Audio ch 0 format: mp2/2ch, 48khz 20bps
STAT: fixing VOBU at 7MB (17/5424, 0%)

*ommited*

STAT: fixing VOBU at 2700MB (5425/5424, 100%)
STAT: fixed 5424 VOBUS
INFO: Scanning /Users/*ommited*/Desktop/*ommited*/VTS_01_1.mpg.DVD/VIDEO_TS/VTS_01_0.IFO

ffooky
2007-10-14, 03:41 PM
Well, the simple answer is that you used ffmpegX rather than Toast and it has compressed the audio. The drop in file size is explained by the change from LPCM->MP2 which also explains the drop in bitrate. It doesn't look like the video stream was re-encoded.

The chapter breaks are stored in the IFO/BUP files of the original VIDEO_TS. If you take my advice and mux with Toast, you may well find that you can simply change the new IFO/BUP files for the old ones or slot your new VOBs into the positions of the originals. I've never done this and you should work with copies of the originals and be prepared to experiment with changing just the VTS_IFO/BUPs or the VIDEO_TS ones as well.

If you want an LPCM audio track you cannot use ffmpegX, at least AFAIK.

ff

ffooky
2007-10-14, 03:43 PM
I always knew there was a reason I liked you. :DA Mac user with an encyclopedic knowledge of port forwarding....
you're the stuff of dreams m'dear ;)

cleantone
2007-10-14, 04:08 PM
Oh okay. I didn't fully get what you were saying about using Toast in your above post. I'll try that out. I didn't know that Toast could mux a M2V and WAV file for you.

cleantone
2007-10-14, 04:40 PM
Worked perfect! You guys are awesome. Thanks a ton.

ffooky
2007-10-14, 04:52 PM
:) Nice.

ffooky
2007-10-14, 07:48 PM
I forgot to ask, were you able to keep the chapter markers and if so, did you need to use the original IFO/BUPs and if so, was it just the VIDEO_TS_IFOs or the VTS ones as well ?

cleantone
2007-10-21, 09:35 AM
This project had no menu and the chapters were arbitrary. I used Toast to multiplex the audio and video back together. It added random chapter marker. I think Sizzle might be able to add them where you want them but I have never used it.

ffooky
2007-10-21, 09:46 AM
Right, thanks for that. We'll just have to wait for a guinea pig with a menu and chapters to find out the finer details.

cleantone
2007-11-04, 06:14 PM
I wanted to bump this thread to ask a question. How would one go about this for non PCM audio? I have been working on a couple of things. One has AC3 stereo audio as the source. I have some fan commentary I want to add onto the DVD for my own viewing pleasure. The fan commentary is in MP3 format. I figure I can convert the MP3 to AIFF and import both the demuxed soundtrack and the new commentary into my multitrack software. Make sure it is all in sync and the same length (to the frame) of the origional. I would then export to WAV. I think I can remultiplex from there. Is there a better way to not recompress the footage. This is another film that I didn't keep the menu and it contains the feature only. Any recommendations?

AAR.oner
2007-11-05, 04:38 AM
if yer only demuxing, messing with the audio, & then re-muxing, there should be no re-compressing of the video footage

cleantone
2007-11-05, 09:02 AM
if yer only demuxing, messing with the audio, & then re-muxing, there should be no re-compressing of the video footage

Yeah I do know that. I think you might have to use different methods (software) depending on the audio format. I have managed to make it work for PCM audio. I was bumping to ask about AC3 sources material. I ended up just letting it recompress the audio on this one. This was not a vital project. Just a wierd fan commentary I didn't want to watch on my computer.