[theora] Add an intro to a theora file without re-encoding?

Michael Opdenacker michael at free-electrons.com
Thu Jul 23 02:20:01 PDT 2009


On 07/22/2009 05:30 PM, yorn at gmx.net wrote:
>> using some programs, that do reencoding. 
>> Thank you very much for these details! I hope I can do without
>> reencoding, because my files are huge.
>>
>> Anyway, I don't think I would be able to use ffmpeg2theora to do this:
>> when I send multiple files to its standard input, it just stops after
>> receiving the first file, as it things that the stream is over.
>>
>> By the way, would you mind looking at a related problem with oggCat, if
>> you can, please? Here's what I ran:
>> oggCat output.ogv intro-nosk.ogv trailer.ogv
>>
>> All the files can be found on
>> http://free-electrons.com/issues/oggvideotools-jul22-2009/
>>
>> The audio stream in output.ogv sounds crappy. Both input files look all
>> right (sample bitrates and sampling frequencies), but generated
>> intro-nosk.ogv file may not be perfect ("nosk" means that I removed the
>> skeleton part with "oggzrip").
>>     
>
> I've discussed something like that with ^j some time ago. I think, the codebook for vorbis does not match for both files. There are several ways how to do the encoding vbr, abr, with upper and lower threshold etc. As far as I understood it is mainly for the encoding process, however sometimes these streams, even if they match in the average bitrate, sample rate etc, they are not really "equal".
>
> I think, here we need a vorbis expert to explain that a bit more.
>
> However. What I do is using oggResize (newest version) This does the reencoding for the audio stream without doing any harm on the video (so this is quite fast). So when I do:
>
> # oggResize -D64000 intro-nosk.ogv intro-nosk2.ogv
> # oggResize -D64000 trailer.ogv trailer2.ogv
> # oggCat output2.ogv intro-nosk2.ogv trailer2.ogv
>
> everything is fine (hopefully) ...
>
> And you don't have to delete the skeleton before ;-).
>   
Hi Yörn,

Thanks a ton!!!

I confirm that your solution works fine on both kinds of videos I
experimented with. The time to resample the input video is acceptable
(approx. 5 minutes for a 1 hour video).

I still have warnings with my output file, though. Would you mind have
yet another look, please? All the input and output files (+ my script)
are available on http://free-electrons.com/issues/oggvideotools-jul23-2009/

$ogginfo output.ogv
Processing file "output.ogv"...

New logical stream (#1, serial: 1d630bff): type theora
New logical stream (#2, serial: 5e2bb0d2): type vorbis
Theora headers parsed for stream 1, information follows...
Version: 3.2.1
Vendor: Xiph.Org libTheora I 20081020 3 2 1
Width: 1280
Height: 720
Total image: 1280 by 720, crop offset (0, 0)
Framerate 25/1 (25.00 fps)
Aspect ratio undefined
Colourspace: Rec. ITU-R BT.470-6 Systems B and G (PAL)
Pixel format 4:2:0
Target bitrate: 0 kbps
Nominal quality setting (0-63): 63
User comments section follows...
    ENCODER=ffmpeg2theora-0.23
Vorbis headers parsed for stream 2, information follows...
Version: 0
Vendor: Xiph.Org libVorbis I 20070622 (1.2.0)
Channels: 2
Rate: 48000

Nominal bitrate: 48.000000 kb/s
Upper bitrate not set
Lower bitrate not set
User comments section follows...
    ENCODER=oggVideoTools 0.8
Warning: Expected frame 5265, got 5266
Warning: Expected frame 5270, got 5269
Warning: Expected frame 12663, got 12664
Warning: Expected frame 12667, got 12666
Warning: Expected frame 13657, got 13658
Warning: Expected frame 13660, got 13659
Warning: Expected frame 14213, got 14214
Warning: Expected frame 14218, got 14217
Warning: Expected frame 14875, got 14876
Warning: Expected frame 14879, got 14878
Warning: Expected frame 17635, got 17636
Warning: Expected frame 17638, got 17637
Vorbis stream 2:
    Total data length: 4322809 bytes
    Playback length: 11m:57.264s
    Average bitrate: 48.214426 kb/s
Logical stream 2 ended
Theora stream 1:
    Total data length: 49279360 bytes
    Playback length: 11m:57.320s
    Average bitrate: 549.594156 kb/s
Logical stream 1 ended

Actually, these warnings are also present in the resampled video (before
oggCat):

$ ogginfo input-resampled.ogv
Processing file "input-resampled.ogv"...

New logical stream (#1, serial: 662dabc4): type theora
New logical stream (#2, serial: 771ef226): type vorbis
Theora headers parsed for stream 1, information follows...
Version: 3.2.1
Vendor: Xiph.Org libTheora I 20081020 3 2 1
Width: 1280
Height: 720
Total image: 1280 by 720, crop offset (0, 0)
Framerate 25/1 (25.00 fps)
Pixel aspect ratio 1:1 (1.000000:1)
Frame aspect 16:9
Colourspace: Rec. ITU-R BT.470-6 Systems B and G (PAL)
Pixel format 4:2:0
Target bitrate: 0 kbps
Nominal quality setting (0-63): 32
User comments section follows...
    ENCODER=ffmpeg2theora-0.23
Vorbis headers parsed for stream 2, information follows...
Version: 0
Vendor: Xiph.Org libVorbis I 20070622 (1.2.0)
Channels: 2
Rate: 48000

Nominal bitrate: 48.000000 kb/s
Upper bitrate not set
Lower bitrate not set
User comments section follows...
    ENCODER=oggVideoTools 0.8
    ENCODER=ffmpeg2theora-0.23
Warning: Expected frame 5115, got 5116
Warning: Expected frame 5120, got 5119
Warning: Expected frame 12513, got 12514
Warning: Expected frame 12517, got 12516
Warning: Expected frame 13507, got 13508
Warning: Expected frame 13510, got 13509
Warning: Expected frame 14063, got 14064
Warning: Expected frame 14068, got 14067
Warning: Expected frame 14725, got 14726
Warning: Expected frame 14729, got 14728
Warning: Expected frame 17485, got 17486
Warning: Expected frame 17488, got 17487
Theora stream 1:
    Total data length: 47127754 bytes
    Playback length: 11m:51.320s
    Average bitrate: 530.031536 kb/s
Logical stream 1 ended
Vorbis stream 2:
    Total data length: 4322529 bytes
    Playback length: 11m:51.327s
    Average bitrate: 48.613624 kb/s
Logical stream 2 ended

Could this reveal an issue in oggResize? I'm also surprised that the
resampled video file (input-resampled.ogv) is smaller than the original
one (input.ogv).

What do you think?

Thanks again for your terrific help. Have a nice day!

Cheers,

Michael.

-- 
Michael Opdenacker, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
+ 33 621 604 642



More information about the theora mailing list