Discussion:
ffmpeg export mpeg2 interlaced
Peter Chiocchetti
2004-09-02 20:16:04 UTC
Permalink
hello,

is there a way to tell the ffmpeg export module to process and
save an interlaced mpeg2 file?

its about transcoding to svcd: ffmpeg looks much closer to the
original than mpeg2enc. So far I only did progressive dv; but
now want to convert found footage, a dvd size mpeg2 to the
svcd spec.

when looking at the file resulting from the conversion with
mpginfo (mpgtx), unlike the source, it always displays "Not
interlaced"

I understand its about ffmpeg using different ways to compute
frame differences etc. with interlaced material; probably it
also might do to just switch the interlaced bit in the final
file? (do decoders use that info?)


command line used: (ffmpeg module seems to ignore parameters
appended with -F, there seems to exist no interlace option in
ffmpeg.cfg, -I and --encode_fields seems not to help either)

transcode -I 2 -V -i ../video.dump -Z fast \
-y ffmpeg,null -F mpeg2,"-ildct -ilme" \
--export_prof svcd -o temp --encode_fields t
mplex -f 4 -o svcd.mpg temp.m2v ../audio.dump

ffmpeg.cfg:

[mpeg2video]
vrc_minrate=0
vrc_maxrate=2500
vrc_buf_size=224
vrc_buf_aggressivity=99
vmax_b_frames=2
aspect=4/3
gray=1


thank you for your attention,

peter
Erik Slagter
2004-09-03 09:49:40 UTC
Permalink
Post by Peter Chiocchetti
is there a way to tell the ffmpeg export module to process and
save an interlaced mpeg2 file?
its about transcoding to svcd: ffmpeg looks much closer to the
original than mpeg2enc. So far I only did progressive dv; but
now want to convert found footage, a dvd size mpeg2 to the
svcd spec.
mpeg2enc is not worse than ffmpeg. It must be a matter of setting
parameters.
Post by Peter Chiocchetti
command line used: (ffmpeg module seems to ignore parameters
appended with -F, there seems to exist no interlace option in
ffmpeg.cfg, -I and --encode_fields seems not to help either)
ffmpeg only recognises codecs with -F.

--encode_fields for ffmpeg is only supported in the cvs and development
versions of transcode.

If you use transcode 0.6.12, specify "ildct" and "ilme" in ffmpeg.cfg.
You may also try to add "alt".

If you use transcode from cvs or development you should use the dvd
export profiling support anyway, which will guess the interlaced-ness.
You can override it with --encode_fields.

Trying to make mpeg2 video for dvd without either specifying the buffer
parameters in ffmpeg.cfg nor using --export_prof is bound to fail,
because the resulting mpeg2 stream is not dvd compliant.

If you do use --export_prof, you don't need to specify -F mpeg2 (there
isn't much sense in e.g. dvd mpeg4, is there?). You only need to specify
-y ffmpeg to use ffmpeg, or leave -y out to use mpeg2enc.
Post by Peter Chiocchetti
[mpeg2video]
vrc_minrate=0
vrc_maxrate=2500
vrc_buf_size=224
vrc_buf_aggressivity=99
vmax_b_frames=2
aspect=4/3
gray=1
Start transcode with -q 1. Watch what ffmpeg says. I will probably tell
you that it enabled interlaced mode.

For the export_prof to work properly, don't try to outsmart it, so
remove all your buffer control options from ffmpeg.cfg (vrc...).

BTW I can't imagine svcd's allows two b frames.
Peter Chiocchetti
2004-09-06 09:27:38 UTC
Permalink
If you use transcode from cvs or development ...
just finished compiling the cvs source: I had to patch
acinclude.m4 and import/decode_dv.c; first patch is ok, I
guess, it just makes configure look up libmpeg3.h directly
below /usr/include, as that is where debian installs it.
second patch is - erm - I dont know what it does: libdv
v103 no longer defines both frame_size_525_60 and
frame_size_625_50, so I just replaced the define with the
values from the dv_types.h that is delivered with transcode
source.

to be continued,

thanks,

peter
Erik Slagter
2004-09-06 09:41:37 UTC
Permalink
Post by Peter Chiocchetti
just finished compiling the cvs source: I had to patch
acinclude.m4 and import/decode_dv.c; first patch is ok, I
guess, it just makes configure look up libmpeg3.h directly
below /usr/include, as that is where debian installs it.
second patch is - erm - I dont know what it does: libdv
v103 no longer defines both frame_size_525_60 and
frame_size_625_50, so I just replaced the define with the
values from the dv_types.h that is delivered with transcode
source.
These issues are already fixed in the development cvs version.
Peter Chiocchetti
2004-09-06 14:21:28 UTC
Permalink
now with a cvs build (!=development?) - my original question
is answered fully :) ffmpeg reports setting the interlacedness
to unknown. mpeginfo then diagnoses the resulting file to
contain an interlaced video stream :)

things learned:
- the buffer in ffmpeg svcd profile is set in bits not bytes
and about half as large as the spec says,
- ffmpeg will not set ilme to 1 automatically when encoding
interlaced footage, should it? I dont know,
- the profile does not consider high bitrate audio: simply
lowering video max rate by 200 in ffmpeg.cfg helped let
mplex do its part.

apropos b-frames: the svcd profile would not do them, acc. to
http://lea.hamradio.si/~s51kq/V-SVCD-S.HTM svcd players are to
support them; this person testifies for b-frames in svcd being
valid too http://www.geocities.com/aussie01au/SVCD.html - I
have yet to test myself.

thank you Erik for your advise,

peter
Erik Slagter
2004-09-07 09:53:21 UTC
Permalink
Post by Peter Chiocchetti
now with a cvs build (!=development?)
cvs at exit1.org != development yeah.
Post by Peter Chiocchetti
- my original question is answered fully :)
ffmpeg reports setting the interlacedness
to unknown. mpeginfo then diagnoses the resulting file to
contain an interlaced video stream :)
Yes, when interlacing isn't set, it guesses that the source is
interlaced (which is almost always the case).
Post by Peter Chiocchetti
- the buffer in ffmpeg svcd profile is set in bits not bytes
and about half as large as the spec says,
Can you test that with multiple players? If it really is, it should be
changed. If have this value from ffmpeg (the program).
Post by Peter Chiocchetti
- ffmpeg will not set ilme to 1 automatically when encoding
interlaced footage, should it? I dont know,
The ffmpeg export sets ilme,ildct and interlacing=top/bottom when you
specify "dvd-pal", "dvd-ntsc" or "dvd-secam" profile, unless you
override these values.
Post by Peter Chiocchetti
- the profile does not consider high bitrate audio: simply
lowering video max rate by 200 in ffmpeg.cfg helped let
mplex do its part.
AFAIK the bitrate in the ffmpeg.cfg is completely ignored.

The rate control of ffmpeg probably ignores the audio bitrate, so you
have to take that in account.
Post by Peter Chiocchetti
apropos b-frames: the svcd profile would not do them, acc. to
http://lea.hamradio.si/~s51kq/V-SVCD-S.HTM svcd players are to
support them; this person testifies for b-frames in svcd being
valid too http://www.geocities.com/aussie01au/SVCD.html - I
have yet to test myself.
The use of b-frames is completely independent of export profiles. You
can use them or not, based upon the setting in ffmpeg.cfg. Default is
none.
Peter Chiocchetti
2004-09-21 10:19:39 UTC
Permalink
Post by Erik Slagter
- the buffer in ffmpeg svcd profile is set in kbits not kbytes
and about half as large as the spec says,
Can you test that with multiple players? If it really is, it should be
changed. If have this value from ffmpeg (the program).
Well, after I learned, that -V (in that version) skips two
colour conversions, I gave mpeg2enc another try; and indeed
now the colours come out the same as in the input :) So I did
stay with that, because it is said to be very mature, and I
dont care about encoding time that much.

but I did notice that it also uses the larger buffer, 230k
says the manpage, which is the same as the 1,835,008 bits of
http://lea.hamradio.si/~s51kq/V-SVCD-S.HTM - so 1800 should be
reasonable in ffmpeg.cfg svcd-profile.

peter
Erik Slagter
2004-09-21 11:03:59 UTC
Permalink
Post by Peter Chiocchetti
but I did notice that it also uses the larger buffer, 230k
says the manpage, which is the same as the 1,835,008 bits of
http://lea.hamradio.si/~s51kq/V-SVCD-S.HTM - so 1800 should be
reasonable in ffmpeg.cfg svcd-profile.
It's already that iirc.
Peter Chiocchetti
2004-09-21 23:48:21 UTC
Permalink
Post by Peter Chiocchetti
but I did notice that it also uses the larger buffer, 230k
says the manpage, which is the same as the 1,835,008 bits of
http://lea.hamradio.si/~s51kq/V-SVCD-S.HTM - so 1800 should be
reasonable in ffmpeg.cfg svcd-profile.
oldconomy cvs has it at 8 times 112; for dvd its 224!
cf export_ffmpeg.c line 618, if I am not mistaken.

peter
Erik Slagter
2004-09-22 09:34:10 UTC
Permalink
Post by Peter Chiocchetti
Post by Peter Chiocchetti
but I did notice that it also uses the larger buffer, 230k
says the manpage, which is the same as the 1,835,008 bits of
http://lea.hamradio.si/~s51kq/V-SVCD-S.HTM - so 1800 should be
reasonable in ffmpeg.cfg svcd-profile.
oldconomy cvs has it at 8 times 112; for dvd its 224!
cf export_ffmpeg.c line 618, if I am not mistaken.
That's correct.

This is the value ffmpeg itself uses, lacking official documentation ($$
$) I assume it's a bit on the safe side. BTW you can always override it
and also it doesn't hurt (that much) to use a smaller buffer, there is
only less room to compensate for sudden high-movement scenes, e.g. more
blocky frames.
Simone Karin Lehmann
2004-09-26 13:31:11 UTC
Permalink
Post by Peter Chiocchetti
Post by Erik Slagter
- the buffer in ffmpeg svcd profile is set in kbits not kbytes
and about half as large as the spec says,
Can you test that with multiple players? If it really is, it should be
changed. If have this value from ffmpeg (the program).
hhmm, which version do you mean? In ffmpeg-0.4.9.-pre-1
in ffmpeg.c at line 3600 vrc_buffer is calculated by 224*1024*8 = 1 835 008.

Svcd-standards use 16-kbit-segments to describe the VBV buffer, it's usually
calculated by doing 112*1024*16 = 1 835 008.

Maybe this has been mixed up in transcodes export_ffmpeg module.
Post by Peter Chiocchetti
but I did notice that it also uses the larger buffer, 230k
says the manpage, which is the same as the 1,835,008 bits of
yes, that's right. See above

Simone Karin
Peter Chiocchetti
2004-09-30 10:05:34 UTC
Permalink
in order to not let this one slip under the table,
Post by Simone Karin Lehmann
Svcd-standards use 16-kbit-segments to describe the VBV buffer, it's usually
calculated by doing 112*1024*16 = 1 835 008.
double ffmpeg svcd profile buffer. pays off eg: less blocky when cam panning.

peter
Erik Slagter
2004-10-06 09:06:53 UTC
Permalink
Post by Peter Chiocchetti
double ffmpeg svcd profile buffer. pays off eg: less blocky when cam panning.
Applied.

Peter Chiocchetti
2004-09-02 19:54:01 UTC
Permalink
hello,

is there a way to tell the ffmpeg export module to either
process and/or save an interlaced mpeg2 file?

its about transcoding to svcd: ffmpeg looks much closer to the
original than mpeg2enc. So far I only did progressive dv; but
now want to convert a dvd size mpeg2 to the svcd spec.

when looking at the resulting file with mpginfo (mpgtx), it always
displays "Not interlaced", unlike the source...

I understand its about ffmpeg using different ways to compute
frame differences etc. with interlaced material; probably it
also might do to just switch the interlaced bit in the final
file? (do decoders use that info?)


command line:

transcode -I 2 -V -i ../video.dump -Z fast \
-y ffmpeg,null -F mpeg2,"-ildct -ilme" \
--export_prof svcd -o temp --encode_fields t
mplex -f 4 -o svcd.mpg temp.m2v ../audio.dump

ffmpeg.cfg:

[mpeg2video]
vrc_minrate=0
vrc_maxrate=2500
vrc_buf_size=224
vrc_buf_aggressivity=99
vmax_b_frames=2
aspect=4/3
gray=1


thank you for your attention,

peter
Peter Chiocchetti
2004-09-03 11:59:50 UTC
Permalink
hello,

would you please make transcodes configure script find
libmpeg3.h, if it sits directly below /usr/include? because,
thats were debian installs it... (simple change in
acinclude.m4)

thank you,

peter
Jens Georg
2004-09-23 08:42:44 UTC
Permalink
Post by Peter Chiocchetti
hello,
would you please make transcodes configure script find
libmpeg3.h, if it sits directly below /usr/include? because,
thats were debian installs it... (simple change in
acinclude.m4)
This is already fixed in oldeconomy CVS
Erik Slagter
2004-09-23 11:11:51 UTC
Permalink
Post by Peter Chiocchetti
would you please make transcodes configure script find
libmpeg3.h, if it sits directly below /usr/include? because,
thats were debian installs it... (simple change in
acinclude.m4)
Specify --with-libmpeg3-incl (or something similar) as /usr.
Peter Chiocchetti
2004-09-23 12:47:23 UTC
Permalink
Post by Erik Slagter
Post by Peter Chiocchetti
would you please make transcodes configure script find
libmpeg3.h, if it sits directly below /usr/include? because,
thats were debian installs it... (simple change in
acinclude.m4)
Specify --with-libmpeg3-incl (or something similar) as /usr.
the cvs in oldconomy does the right thing for debian :)

thanks,

peter

PS: some weeks old posts today appeared again?
Loading...