[PATCH] AVISynth support for some MS DIB formats
Some codec don't get decoded to some nice YUV formats in AVISynth. They use different DIB formats as explained here: http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dx81_c/dire... Here is a patch to correct this in the AVISynth code. Steve
Hi On Wed, Sep 27, 2006 at 07:20:26PM +0200, Steve Lhomme wrote:
Some codec don't get decoded to some nice YUV formats in AVISynth. They use different DIB formats as explained here:
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dx81_c/dire...
Here is a patch to correct this in the AVISynth code.
Steve
Index: avisynth.c =================================================================== --- avisynth.c (revision 6352) +++ avisynth.c (working copy) @@ -95,6 +95,7 @@ stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8;
st->codec->codec_id = wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_sample); + st->codec->codec_tag = stream->info.fccHandler;
this looks wrong stream->info.fccHandler should be st->codec->stream_codec_tag and wvfmt.wFormatTag should be codec_tag
} else if (stream->info.fccType == streamtypeVIDEO) { @@ -117,7 +118,27 @@
st->codec->bits_per_sample = stream->info.dwSampleSize * 8; st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale; - st->codec->codec_id = codec_get_id(codec_bmp_tags, stream->info.fccHandler);
same here, it should be imgfmt.bmiHeader.biCompression not stream->info.fccHandler id also guess thats why the code didnt work though iam just guessing, what happens if you change these? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In the past you could go to a library and read, borrow or copy any book Today you'd get arrested for mere telling someone where the library is
Michael Niedermayer wrote:
Index: avisynth.c =================================================================== --- avisynth.c (revision 6352) +++ avisynth.c (working copy) @@ -95,6 +95,7 @@ stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8;
st->codec->codec_id = wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_sample); + st->codec->codec_tag = stream->info.fccHandler;
this looks wrong stream->info.fccHandler should be st->codec->stream_codec_tag and wvfmt.wFormatTag should be codec_tag
} else if (stream->info.fccType == streamtypeVIDEO) { @@ -117,7 +118,27 @@
st->codec->bits_per_sample = stream->info.dwSampleSize * 8; st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale; - st->codec->codec_id = codec_get_id(codec_bmp_tags, stream->info.fccHandler);
same here, it should be imgfmt.bmiHeader.biCompression not stream->info.fccHandler id also guess thats why the code didnt work though iam just guessing, what happens if you change these?
I'll give this a try. I'll keep you updated. Steve
Steve Lhomme wrote:
Michael Niedermayer wrote:
Index: avisynth.c =================================================================== --- avisynth.c (revision 6352) +++ avisynth.c (working copy) @@ -95,6 +95,7 @@ stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8;
st->codec->codec_id = wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_sample); + st->codec->codec_tag = stream->info.fccHandler;
this looks wrong stream->info.fccHandler should be st->codec->stream_codec_tag and wvfmt.wFormatTag should be codec_tag
} else if (stream->info.fccType == streamtypeVIDEO) { @@ -117,7 +118,27 @@
st->codec->bits_per_sample = stream->info.dwSampleSize * 8; st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale; - st->codec->codec_id = codec_get_id(codec_bmp_tags, stream->info.fccHandler);
same here, it should be imgfmt.bmiHeader.biCompression not stream->info.fccHandler id also guess thats why the code didnt work though iam just guessing, what happens if you change these?
I'll give this a try. I'll keep you updated.
OK, it's better (more general). Here is the patch. Steve
Hi,
Steve Lhomme wrote:
Michael Niedermayer wrote:
Index: avisynth.c =================================================================== --- avisynth.c (revision 6352) +++ avisynth.c (working copy) @@ -95,6 +95,7 @@ stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8;
st->codec->codec_id = wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_sample); + st->codec->codec_tag = stream->info.fccHandler;
this looks wrong stream->info.fccHandler should be st->codec->stream_codec_tag and wvfmt.wFormatTag should be codec_tag
} else if (stream->info.fccType == streamtypeVIDEO) { @@ -117,7 +118,27 @@
st->codec->bits_per_sample = stream->info.dwSampleSize * 8; st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale; - st->codec->codec_id = codec_get_id(codec_bmp_tags, stream->info.fccHandler);
same here, it should be imgfmt.bmiHeader.biCompression not stream->info.fccHandler id also guess thats why the code didnt work though iam just guessing, what happens if you change these?
I'll give this a try. I'll keep you updated.
OK, it's better (more general). Here is the patch.
I tried the patch on SVN-r6027, but it gives me an all black frames movie. This was the command: $ ~/src/FFmpeg-20060928-6364/ffmpeg/ffmpeg -i 60.avs -vtag DIVX -acodec copy out.avi FFmpeg version SVN-r6364, Copyright (c) 2000-2004 Fabrice Bellard configuration: --enable-mp3lame --enable-a52 --disable-static --enable-shared --enable-pthreads --enable-swscaler --enable-avisynth --enable-gpl libavutil version: 49.0.1 libavcodec version: 51.16.0 libavformat version: 50.5.0 built on Sep 28 2006 19:51:40, gcc: 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) Input #0, avs, from '60.avs': Duration: 00:01:00.3, start: 0.000000, bitrate: 0 kb/s Stream #0.0: Video: rawvideo, yuv420p, 720x576, 124416 kb/s, 25.00 fps(r) Stream #0.1: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s Output #0, avi, to 'out.avi': Stream #0.0: Video: mpeg4, yuv420p, 720x576, q=2-31, 200 kb/s, 25.00 fps(c) Stream #0.1: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1 Press [q] to stop encoding frame= 410 q=31.0 Lsize= 3942kB time=0.0 bitrate=807387.6kbits/s video:846kB audio:3068kB global headers:0kB muxing overhead 0.742793% The avs is simple: DirectShowSource("60.avi") And the source is $ ffmpeg -i 60.avi FFmpeg version SVN-r6027, Copyright (c) 2000-2004 Fabrice Bellard configuration: --enable-mp3lame --enable-a52 --disable-static --enable-shared --enable-pthreads --enable-avisynth --enable-gpl libavutil version: 49.0.0 libavcodec version: 51.11.0 libavformat version: 50.5.0 built on Aug 20 2006 01:37:22, gcc: 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) Input #0, avi, from '60.avi': Duration: 00:01:00.3, start: 0.000000, bitrate: 2155 kb/s Stream #0.0: Video: mpeg4, yuv420p, 720x576, 25.00 fps(r) Stream #0.1: Audio: mp3, 48000 Hz, stereo, 128 kb/s Must supply at least one output file Regards, V?ctor Paesa
V?ctor Paesa wrote:
Hi,
I tried the patch on SVN-r6027, but it gives me an all black frames movie.
This was the command: $ ~/src/FFmpeg-20060928-6364/ffmpeg/ffmpeg -i 60.avs -vtag DIVX -acodec copy out.avi FFmpeg version SVN-r6364, Copyright (c) 2000-2004 Fabrice Bellard configuration: --enable-mp3lame --enable-a52 --disable-static --enable-shared --enable-pthreads --enable-swscaler --enable-avisynth --enable-gpl libavutil version: 49.0.1 libavcodec version: 51.16.0 libavformat version: 50.5.0 built on Sep 28 2006 19:51:40, gcc: 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) Input #0, avs, from '60.avs': Duration: 00:01:00.3, start: 0.000000, bitrate: 0 kb/s Stream #0.0: Video: rawvideo, yuv420p, 720x576, 124416 kb/s, 25.00 fps(r) Stream #0.1: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s Output #0, avi, to 'out.avi': Stream #0.0: Video: mpeg4, yuv420p, 720x576, q=2-31, 200 kb/s, 25.00 fps(c) Stream #0.1: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1 Press [q] to stop encoding frame= 410 q=31.0 Lsize= 3942kB time=0.0 bitrate=807387.6kbits/s video:846kB audio:3068kB global headers:0kB muxing overhead 0.742793%
The avs is simple: DirectShowSource("60.avi")
And the source is $ ffmpeg -i 60.avi FFmpeg version SVN-r6027, Copyright (c) 2000-2004 Fabrice Bellard configuration: --enable-mp3lame --enable-a52 --disable-static --enable-shared --enable-pthreads --enable-avisynth --enable-gpl libavutil version: 49.0.0 libavcodec version: 51.11.0 libavformat version: 50.5.0 built on Aug 20 2006 01:37:22, gcc: 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) Input #0, avi, from '60.avi': Duration: 00:01:00.3, start: 0.000000, bitrate: 2155 kb/s Stream #0.0: Video: mpeg4, yuv420p, 720x576, 25.00 fps(r) Stream #0.1: Audio: mp3, 48000 Hz, stereo, 128 kb/s Must supply at least one output file
Do you know what filters are used in DirectShow ? Steve
Hi,
V?ctor Paesa wrote:
Hi,
I tried the patch on SVN-r6027, but it gives me an all black frames movie.
I must correct myself, it was applied onto SVN-r6364 (as the output shows)
This was the command: $ ~/src/FFmpeg-20060928-6364/ffmpeg/ffmpeg -i 60.avs -vtag DIVX -acodec copy out.avi FFmpeg version SVN-r6364, Copyright (c) 2000-2004 Fabrice Bellard configuration: --enable-mp3lame --enable-a52 --disable-static --enable-shared --enable-pthreads --enable-swscaler --enable-avisynth --enable-gpl libavutil version: 49.0.1 libavcodec version: 51.16.0 libavformat version: 50.5.0 built on Sep 28 2006 19:51:40, gcc: 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) Input #0, avs, from '60.avs': Duration: 00:01:00.3, start: 0.000000, bitrate: 0 kb/s Stream #0.0: Video: rawvideo, yuv420p, 720x576, 124416 kb/s, 25.00 fps(r) Stream #0.1: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s Output #0, avi, to 'out.avi': Stream #0.0: Video: mpeg4, yuv420p, 720x576, q=2-31, 200 kb/s, 25.00 fps(c) Stream #0.1: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1 Press [q] to stop encoding frame= 410 q=31.0 Lsize= 3942kB time=0.0 bitrate=807387.6kbits/s video:846kB audio:3068kB global headers:0kB muxing overhead 0.742793%
The avs is simple: DirectShowSource("60.avi")
And the source is $ ffmpeg -i 60.avi FFmpeg version SVN-r6027, Copyright (c) 2000-2004 Fabrice Bellard configuration: --enable-mp3lame --enable-a52 --disable-static --enable-shared --enable-pthreads --enable-avisynth --enable-gpl libavutil version: 49.0.0 libavcodec version: 51.11.0 libavformat version: 50.5.0 built on Aug 20 2006 01:37:22, gcc: 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) Input #0, avi, from '60.avi': Duration: 00:01:00.3, start: 0.000000, bitrate: 2155 kb/s Stream #0.0: Video: mpeg4, yuv420p, 720x576, 25.00 fps(r) Stream #0.1: Audio: mp3, 48000 Hz, stereo, 128 kb/s Must supply at least one output file
Do you know what filters are used in DirectShow ?
It ended up being a problem of SVN-r6364, if I apply your patch to SVN-r6349 everything goes fine. Sorry for the noise. Regards, V?ctor Paesa
Hi On Thu, Sep 28, 2006 at 02:17:51PM +0200, Steve Lhomme wrote:
Steve Lhomme wrote:
Michael Niedermayer wrote:
Index: avisynth.c =================================================================== --- avisynth.c (revision 6352) +++ avisynth.c (working copy) @@ -95,6 +95,7 @@ stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8;
st->codec->codec_id = wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_sample); + st->codec->codec_tag = stream->info.fccHandler;
this looks wrong stream->info.fccHandler should be st->codec->stream_codec_tag and wvfmt.wFormatTag should be codec_tag
} else if (stream->info.fccType == streamtypeVIDEO) { @@ -117,7 +118,27 @@
st->codec->bits_per_sample = stream->info.dwSampleSize * 8; st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale; - st->codec->codec_id = codec_get_id(codec_bmp_tags, stream->info.fccHandler);
same here, it should be imgfmt.bmiHeader.biCompression not stream->info.fccHandler id also guess thats why the code didnt work though iam just guessing, what happens if you change these?
I'll give this a try. I'll keep you updated.
OK, it's better (more general). Here is the patch.
looks ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In the past you could go to a library and read, borrow or copy any book Today you'd get arrested for mere telling someone where the library is
Hi, On 9/29/06, Michael Niedermayer <michaelni at gmx.at> wrote: [..]
OK, it's better (more general). Here is the patch.
looks ok
Applied Guillaume -- With DADVSI (http://en.wikipedia.org/wiki/DADVSI), France finally has a lead on USA on selling out individuals right to corporations! Vive la France!
participants (5)
-
michaelni@gmx.at -
poirierg@gmail.com -
slhomme@divxcorp.com -
steve.lhomme@free.fr -
wzrlpy@arsystel.com