View Full Version : How to cut-and-paste OGG Vodbis w/o reencoding?
Elic
23rd June 2005, 22:47
Hi there!
I have an old movie with two versions of same soundtrack, both are encoded with OGG Vorbis, encoding parameters are identical, and both tracks are damaged (on different places hopefully). I want to cut both tracks in several pieces and re-assemble one track from them (but I don't want to re-encoding them because their quality is relatively low).
But, when I try to cut-and-paste OGG Vorbis soundtrack (by vcut from vorbis-tools 1.0.1 (http://www.vorbis.com/download_win_1.0.1.psp), or by MusiCutter (http://musicutter.host.sk)), I got OGG file with multiple logical streams. And then, when I try to mux it with video (into OGM - by VirtualDubMod, or into Matroska - by mkvtoolnix), I got video OK but sound ends at first pasting.
So, how can I paste multiple Vorbis logical streams into one logical stream? Or, how can I mux .OGG soundtrack with multiple logical streams into OGM or MKV a/v container?
stephanV
23rd June 2005, 22:51
maybe you can use mkvtoolnix for the job... it should allow you to cut and paste vorbis streams in MKV.
Elic
24th June 2005, 00:05
stephanV
> mkvtoolnix [...] should allow you to cut and paste
Thanx! Tell me please in detail how to cut-and-paste with mkvtoolniх. Or tell me where I can read about it.
Elic
24th June 2005, 00:39
2 Moderator:
I put this thread accidentally onto wrong forum. Please move it into proper place (for instance, into "New and alternative a/v containers (http://forum.doom9.org/forumdisplay.php?f=74)"). I am sorry for inconvenience.
celtic_druid
24th June 2005, 01:51
If the two sound tracks are identical, just cut/join the raw data. You could use a file splitter, cut both up into chunks,then swap the pieces and re-join.
Elic
24th June 2005, 09:08
celtic_druid
> If the two sound tracks are identical, just cut/join the raw data
Unfortunately tracks are NOT binary identical. Maybe their sources (.wav files) were identical, but rather they were two different digital copies from the same magnetic tape. So binary cut/paste is not workable, I tried this trick at first of all.
Also I tried to cut pieces by vcut and cut video into pieces of same duration (by VirtualDubMod), assemble short OGM fragments from coresponding audio and video pieces, assemble entire OGM from this fragments in proper order, and demux soundtrack from it. As a result, I get a soundtrack which consists of one logical stream (as expected) but proved to be about 300 milliseconds longer than expected, and it had small fragments of silence (or nearly silence) after each cut/paste point. So this technique is unusable too :(
stephanV
24th June 2005, 09:33
it will probably cost you some time since i believe MKVToolnix can only cut on regular intervals. but in mmg.exe you can go to the global tab to find the option. or use mkvmerge.exe with --split.
Elic
24th June 2005, 10:01
stephanV
> MKVToolnix can only cut on regular intervals
Well, I will try it. But OGG soundtrack can be cutted in arbitrary sample by vcut. Main problem is how to either join fragments into one logical stream without lacunae, or merge soundtrack with multiple logical streams into OGM or Matroska movie.
stephanV
24th June 2005, 13:22
i guess the eaiest way would be adding the files in avimux GUI in the right order. use CTRL+mouse to select all files and press generate data from source files... that should join them and out put to a .mka file
bond
25th June 2005, 11:37
afaik you can normally simply append multiple ogg vorbis files to each other (called "chained streams") and they should play as one, eg via dos commandline:
copy /b first.ogg + second.ogg joined.oggif such a file doesnt play there is propably something wrong with the player you use, so which one did you use?
it seems directshow isnt really capable of handling this, so try non-directshow players too
i found an interesting thread about this and playback problems here:
http://forum.doom9.org/showthread.php?t=67147
moved
stephanV
25th June 2005, 17:12
while that joining works, a lot of muxers will only see the first stream. read his posts about multi-logical streams.
Elic
26th June 2005, 12:42
bond >> "chained streams" [...] copy /b first.ogg + second.ogg joined.ogg
stephanV > a lot of muxers will only see the first stream
That is true. :) Moreover, I don't know such muxer that can handle chained streams :(
I tried VirtualDubMod, mkvmerge and OGMuxer (from ogmtools) - all of them handle first logical stream only.
I also tried to paste fragments into single file by OGMerger - exactly same effect as when assembling OGM fragments by VirtualDubMod: resulting track is one logical track but is about 300-400 ms longer than expected. Same thing with AVIMux-GUI: convert every fragment into MKA, load all MKA's, generate data from source - same effect, resulting MKA is longer and contains lacunae :(
bond
26th June 2005, 13:21
you can also try to work on the raw vorbis streams (i assume ffmpeg can demux from .ogg to raw), maybe its possible to than remux this raw vorbis stream to .ogg with ffmpeg too?
Elic
27th June 2005, 23:44
bond
> ffmpeg can demux from .ogg to raw
Yes, but
> maybe its possible to than remux this raw vorbis stream to .ogg with ffmpeg too?
"Theoretically - yes" (c) Vitto Cornelius :) , but I didn't find how to do this. And, moreover, I didn't find any tool to mux raw vorbis data into ogg, or mka, or anyone other container. So I think raw vorbis data was invented for debug purposes only :)
So I shall dig into vorbis packet structure and try to find out why valuable attributes of ogg packets (i.e. actual samples count) is vanishing during join-ogg-into-one-logical-stream :)
bond
28th June 2005, 00:28
if mp4box supports exporting vorbis from .mp4 to .ogg you can try importing your ogg vorbis streams to .mp4 with mp4box, than cut and paste the stream with mp4box and than export the resulting stream to .ogg again
bond
> if mp4box supports exporting vorbis from .mp4 to .ogg
Yes, but I can find export "raw" stream only. And I tested how mp4box and mp4creator perform joining .ogg files. I found that mp4creator preserves multiple logical streams and mp4box joins streams into one logical stream but resulting stream becomes significantly shotrer (about 150 ms per cutpoint).
Seems to be that my problem cannot be resolved by "conventional" tools, and I will "dig" sources of libraries, tools, etc. Sorry for inconvenience.
Kurtnoise
3rd July 2005, 00:11
Elic : try with oggzmerge (http://www.aziendeassociate.it/cd//Misc/oggztools2005.04.14.7z)...
Kurtnoise13
Hmm... oggzmerge produces trivial cnained streams exactly as "copy /b ogg1 + ogg2" can, and I cannot try other oggztools because of lack of docs (even Google returns no matches :( )
multicone
3rd July 2005, 22:22
Did you try creating .MKAs from your .OGGs, and append them with avi-mux GUI ?
Haali
3rd July 2005, 22:37
Vorbis streams have some codec setup parameters at start of stream. Our current software doesnt allow changing them in the middle of a file. So if these setup blocks are not identical, joining streams won't work.
Kurtnoise13
Sorry, I was wrong. I merged together 15 clips (clippped from two .ogg files by vcut) by oggzmerge, and got file contains 15 logical streams (as ogginfo reports). Then I tried to mux that file with video by mmg and got movie with 15 simultaneous short audio tracks! 8-()
multicone
OGG -> MKA and then AVIMux-GUI: resulting audio is longer than expected, with gaps and claps around paste-points.
Haali
What parameters do you mean? All OGGs I played with was made by oggenc (from vorbis-tools 1.0.1) with same parameter "-q 4.36".
Elic
12th July 2005, 22:33
Finally, I resolved local problem by displacing every cutpoint up to 20..50 milliseconds earlier or later, and got final desync less than 10 ms. It's not exactly what I want to have, but seems to be that absolutely correct solution isn't exist :(
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.