You are not logged in.

#1 2007-09-21 12:26:21

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

FFMPEG successfully reverse engineered RV30/RV40!

FFMPEG's GSoC project to reverse engineer RealMedia's RV30 and RV40 codecs has been successful. It looks like there is still work to do, but it's a reality now:

http://lists.mplayerhq.hu/pipermail/ffm … 35486.html

They are also finishing other needed stuff like their Monkey Audio decoder, Matroska muxer, support for RTSP, RTP, MMS, and other streams, and much more.

It looks as if the dream of Linux being able to play just about anything with native, open source code is coming to fruition. On top of that, FFMPEG has matured before MPlayer or VLC has had to start their inevitable legal battles that have been brewing for years. After all, FFMPEG was started because MPlayer's future was looking pretty grim.

This is indeed a very good thing for all of the *nix family.

Offline

#2 2007-09-21 15:18:07

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: FFMPEG successfully reverse engineered RV30/RV40!

Wow!!!!


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#3 2007-09-21 15:54:25

hussam
Member
Registered: 2006-03-26
Posts: 572
Website

Re: FFMPEG successfully reverse engineered RV30/RV40!

I'll do a svn ffmpeg snapshot and check it out.

Offline

#4 2007-09-21 16:01:37

mic64
Member
Registered: 2005-03-03
Posts: 173

Re: FFMPEG successfully reverse engineered RV30/RV40!

if you´re doing a PKGBUILD, please add the eac3 codec patch also.

Offline

#5 2007-09-22 01:13:04

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: FFMPEG successfully reverse engineered RV30/RV40!

hussam wrote:

I'll do a svn ffmpeg snapshot and check it out.

It doesn't work just yet; I tried today. It looks from that mailing list thread that there are a few bugs to work out still as well as get the code up to FFMPEG's coding standards.

Offline

#6 2007-09-25 02:14:26

ConnorBehan
Package Maintainer (PM)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,359
Website

Re: FFMPEG successfully reverse engineered RV30/RV40!

FFMpeg is a machine, they have SO many formats available and so many options.  The man page is more like 27 pages and I recommend it to my windows using friends when they wan't to covert and avi into an mpeg or something like that.  (Most of them fail to install it and give up tongue).  One of the codecs is disabled by default in the Arch package, I wonder why... oh well that can be changed soon wink.


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

#7 2007-09-25 14:12:56

Noneus
Member
From: Munich
Registered: 2006-09-26
Posts: 118
Website

Re: FFMPEG successfully reverse engineered RV30/RV40!

I didn't get eac3 to work... But its really great what SoC does to ffmpeg and the players based on it.

Offline

#8 2007-09-25 16:55:19

Fackamato
Member
Registered: 2006-03-31
Posts: 579

Re: FFMPEG successfully reverse engineered RV30/RV40!

What is this RV30/RV40? tongue

Offline

#9 2007-09-25 17:19:56

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: FFMPEG successfully reverse engineered RV30/RV40!

They are codecs for ffmpeg.......etc...


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#10 2007-09-25 18:12:34

chaosgeisterchen
Member
From: Kefermarkt, Upper Austria
Registered: 2006-11-20
Posts: 550

Re: FFMPEG successfully reverse engineered RV30/RV40!

Fackamato wrote:

What is this RV30/RV40? tongue

RealMedia codecs AFAIK - which FFMpeg was not able to playback until now.


celestary
Intel Core2Duo E6300 @ 1.86 GHz
kernel26
KDEmod current repository

Offline

#11 2007-09-25 18:51:54

Fackamato
Member
Registered: 2006-03-31
Posts: 579

Re: FFMPEG successfully reverse engineered RV30/RV40!

chaosgeisterchen wrote:
Fackamato wrote:

What is this RV30/RV40? tongue

RealMedia codecs AFAIK - which FFMpeg was not able to playback until now.

Ah ok smile

Offline

#12 2007-09-26 01:17:10

robotangel
Member
From: cologne/germany
Registered: 2007-08-30
Posts: 63

Re: FFMPEG successfully reverse engineered RV30/RV40!

Well, time for a new SVN Build in the repos :=)

Offline

#13 2007-09-26 02:37:58

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: FFMPEG successfully reverse engineered RV30/RV40!

Current SVN still doesn't have the changes I posted. But, this is a modified ffmpeg.patch file that will give rudimentary eac3 support to a very current (today works) SVN version of FFMPEG. The subversion repo to pull it and all the eac3 stuff down from is:

http://svn.mplayerhq.hu/soc/eac3/

So, to drop the files into the directory eac3 in the current directory:

svn checkout svn://svn.mplayerhq.hu/soc/eac3 eac3

All the C source and header files need to be dropped into libavcodec from FFMPEG:

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

The modified patch. This replaces ffmpeg.patch from the eac3 directory:

Index: libavcodec/ac3_parser.c
===================================================================
--- libavcodec/ac3_parser.c    (wersja 10220)
+++ libavcodec/ac3_parser.c    (kopia robocza)
@@ -84,7 +84,7 @@
     return 0;
 }
 
-static int ac3_sync(const uint8_t *buf, int *channels, int *sample_rate,
+static int ac3_sync(AVCodecContext *avctx, const uint8_t *buf, int *channels, int *sample_rate,
                     int *bit_rate, int *samples)
 {
     int err;
@@ -100,12 +100,16 @@
 
     bsid = hdr.bsid;
     if(bsid <= 10) {             /* Normal AC-3 */
+        if(avctx->codec_id == CODEC_ID_EAC3)
+            avctx->codec_id = CODEC_ID_AC3;
         *sample_rate = hdr.sample_rate;
         *bit_rate = hdr.bit_rate;
         *channels = hdr.channels;
         *samples = AC3_FRAME_SIZE;
         return hdr.frame_size;
     } else if (bsid > 10 && bsid <= 16) { /* Enhanced AC-3 */
+        if(avctx->codec_id == CODEC_ID_AC3)
+            avctx->codec_id = CODEC_ID_EAC3;
         init_get_bits(&bits, &buf[2], (AC3_HEADER_SIZE-2) * 8);
         strmtyp = get_bits(&bits, 2);
         substreamid = get_bits(&bits, 3);
@@ -152,6 +156,13 @@
     return 0;
 }
 
+AVCodecParser eac3_parser = {
+    { CODEC_ID_EAC3 },
+    sizeof(AACAC3ParseContext),
+    ac3_parse_init,
+    ff_aac_ac3_parse,
+    NULL,
+};
 
 AVCodecParser ac3_parser = {
     { CODEC_ID_AC3 },
Index: libavcodec/Makefile
===================================================================
--- libavcodec/Makefile    (wersja 10220)
+++ libavcodec/Makefile    (kopia robocza)
@@ -64,6 +64,7 @@
 OBJS-$(CONFIG_DVVIDEO_DECODER)         += dv.o
 OBJS-$(CONFIG_DVVIDEO_ENCODER)         += dv.o
 OBJS-$(CONFIG_DXA_DECODER)             += dxa.o
+OBJS-$(CONFIG_EAC3_DECODER)            += eac3dec.o ac3dec.o
 OBJS-$(CONFIG_EIGHTBPS_DECODER)        += 8bps.o
 OBJS-$(CONFIG_FFV1_DECODER)            += ffv1.o rangecoder.o golomb.o
 OBJS-$(CONFIG_FFV1_ENCODER)            += ffv1.o rangecoder.o
Index: libavcodec/aac_ac3_parser.c
===================================================================
--- libavcodec/aac_ac3_parser.c    (wersja 10220)
+++ libavcodec/aac_ac3_parser.c    (kopia robocza)
@@ -48,7 +48,7 @@
             s->inbuf_ptr += len;
             buf_size -= len;
             if ((s->inbuf_ptr - s->inbuf) == s->header_size) {
-                len = s->sync(s->inbuf, &channels, &sample_rate, &bit_rate,
+                len = s->sync(avctx, s->inbuf, &channels, &sample_rate, &bit_rate,
                               &samples);
                 if (len == 0) {
                     /* no sync found : move by one byte (inefficient, but simple!) */
@@ -59,7 +59,7 @@
                     /* update codec info */
                     avctx->sample_rate = sample_rate;
                     /* set channels,except if the user explicitly requests 1 or 2 channels, XXX/FIXME this is a bit ugly */
-                    if(avctx->codec_id == CODEC_ID_AC3){
+                    if(avctx->codec_id == CODEC_ID_AC3 || avctx->codec_id == CODEC_ID_EAC3){
                         if(avctx->channels!=1 && avctx->channels!=2){
                             avctx->channels = channels;
                         }
Index: libavcodec/aac_ac3_parser.h
===================================================================
--- libavcodec/aac_ac3_parser.h    (wersja 10220)
+++ libavcodec/aac_ac3_parser.h    (kopia robocza)
@@ -30,7 +30,7 @@
     uint8_t *inbuf_ptr;
     int frame_size;
     int header_size;
-    int (*sync)(const uint8_t *buf, int *channels, int *sample_rate,
+    int (*sync)(AVCodecContext *avctx, const uint8_t *buf, int *channels, int *sample_rate,
                 int *bit_rate, int *samples);
     uint8_t inbuf[8192]; /* input buffer */
 } AACAC3ParseContext;
Index: libavcodec/aac_parser.c
===================================================================
--- libavcodec/aac_parser.c    (wersja 10220)
+++ libavcodec/aac_parser.c    (kopia robocza)
@@ -38,7 +38,7 @@
 };
 
 
-static int aac_sync(const uint8_t *buf, int *channels, int *sample_rate,
+static int aac_sync(AVCodecContext *avctx, const uint8_t *buf, int *channels, int *sample_rate,
                     int *bit_rate, int *samples)
 {
     GetBitContext bits;
Index: libavcodec/allcodecs.c
===================================================================
--- libavcodec/allcodecs.c    (wersja 10220)
+++ libavcodec/allcodecs.c    (kopia robocza)
@@ -178,6 +178,7 @@
     REGISTER_DECODER (COOK, cook);
     REGISTER_DECODER (DCA, dca);
     REGISTER_DECODER (DSICINAUDIO, dsicinaudio);
+    REGISTER_DECODER (EAC3, eac3);
     REGISTER_ENCDEC  (FLAC, flac);
     REGISTER_DECODER (IMC, imc);
     REGISTER_ENCDEC  (LIBAMR_NB, libamr_nb);
@@ -272,6 +272,7 @@
     REGISTER_PARSER  (DCA, dca);
     REGISTER_PARSER  (DVBSUB, dvbsub);
     REGISTER_PARSER  (DVDSUB, dvdsub);
+    REGISTER_PARSER  (EAC3, eac3);
     REGISTER_PARSER  (H261, h261);
     REGISTER_PARSER  (H263, h263);
     REGISTER_PARSER  (H264, h264);
Index: libavcodec/avcodec.h
===================================================================
--- libavcodec/avcodec.h    (wersja 10220)
+++ libavcodec/avcodec.h    (kopia robocza)
@@ -261,6 +261,7 @@
     CODEC_ID_GSM_MS, /* as found in WAV */
     CODEC_ID_ATRAC3,
     CODEC_ID_VOXWARE,
     CODEC_ID_APE,
+    CODEC_ID_EAC3,
 
     /* subtitle codecs */
     CODEC_ID_DVD_SUBTITLE= 0x17000,
Index: libavcodec/allcodecs.h
===================================================================
--- libavcodec/ac3enc.c    (wersja 10220)
+++ libavcodec/ac3enc.c    (kopia robocza)
@@ -479,7 +479,8 @@
         for(ch=0;ch<s->nb_all_channels;ch++) {
             ff_ac3_bit_alloc_calc_bap(mask[i][ch], psd[i][ch], 0,
                                       s->nb_coefs[ch], snroffset,
-                                      s->bit_alloc.floor, bap[i][ch]);
+                                      s->bit_alloc.floor, ff_ac3_baptab,
+                                      bap[i][ch]);
             frame_bits += compute_mantissa_size(s, bap[i][ch],
                                                  s->nb_coefs[ch]);
         }
Index: ffmpeg.c
===================================================================
--- ffmpeg.c    (wersja 10220)
+++ ffmpeg.c    (kopia robocza)
@@ -1577,6 +1577,7 @@
                 } else {
                     if (codec->channels != icodec->channels &&
                         (icodec->codec_id == CODEC_ID_AC3 ||
+                         icodec->codec_id == CODEC_ID_EAC3 ||
                          icodec->codec_id == CODEC_ID_DTS)) {
                         /* Special case for 5:1 AC3 and DTS input */
                         /* and mono or stereo output      */

I'm not going to post a PKGBUILD for this. It's too much work for something that doesn't really function yet. I mean, the .evo test file from MPlayer works basically, but both the video and audio are choppy. The other test file I picked up doesn't work at all.

Oh yeah, if anyone cares, this is part of the output from FFMPEG:

Input #0, mpeg, from 'MAININTRO.EVO':
  Duration: 00:01:04.2, start: 0.038278, bitrate: 17089 kb/s
  Stream #0.0[0xfd55]: Video: vc1, yuv420p, 1920x1080, 29.97 fps(r)
  Stream #0.1[0xc0]: Audio: E-AC3, 48000 Hz, 5:1, 768 kb/s

---------------------- I did tell one lie (at least) -----------------------

I was able to play a MonkeyAudio (.ape) file with FFPlay. That's new!

Last edited by skottish (2007-09-26 04:46:39)

Offline

#14 2007-09-28 01:52:42

hussam
Member
Registered: 2006-03-26
Posts: 572
Website

Re: FFMPEG successfully reverse engineered RV30/RV40!

The RV30/RV40 patches worked for me. now ffplay can play realmedia ( Note that I don't have the codecs package installed or anything like that)

Offline

#15 2007-09-28 02:55:20

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: FFMPEG successfully reverse engineered RV30/RV40!

Cool hussam!

Since there's interest in this, I'll post my FFMPEG/SOC build files tomorrow (eac3 and rv40... for now). I just need to run some more tests. The thing that's really tricky about this is FFMPEG is a very fast moving target. Patches break easily with this one...

Offline

#16 2007-09-28 09:49:43

hussam
Member
Registered: 2006-03-26
Posts: 572
Website

Re: FFMPEG successfully reverse engineered RV30/RV40!

I do however fear that those SOC patches will stop being maintained now that the summer is over. It's a pity. hmm

Offline

#17 2007-09-28 10:08:13

Noneus
Member
From: Munich
Registered: 2006-09-26
Posts: 118
Website

Re: FFMPEG successfully reverse engineered RV30/RV40!

I'm just wondering when this soc stuff will be in ffmpeg trunk and mplayer-svn.....

Offline

#18 2007-09-28 15:44:30

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: FFMPEG successfully reverse engineered RV30/RV40!

This is the system that I use to build FFMPEG, including SOC RV40 and EAC3. It's set up the way it is in order to pull the subversion sources down, and build a package named after the date of the build. Dating the package will keep any conflicts from installing software with Pacman.

NOTE: I didn't write the PKGBUILD file; I only edited it. I left the author(s) info in the file. Thanks for your work.

I made no attempt to edit this from my regular usage, which is to say, it's currently designed to build against x264, libogg, libvorbis, libtheora, amr nb and wb (both from AUR). If you don't need any of these things, edit the depends line in original_PKGBUILD, as well as the enable lines in the configure script.

WARNING: I have swscaler enabled. This WILL break VLC 8.6.c. If you don't want this, remove the –enable-swscaler line from original_PKGBUILD. VLC-svn is currently functional, but it's also buggy.

The build script, build_ffmpeg_svn.sh, will make a PKGBUILD file out of original_PKGBUILD with adding the current date as pkgver. All of the subversion sources will be brought down into the current directory, and the SOC files will be placed into libavcodec.

WARNING 2: After the build script runs makepkg, it will attempt to install the package with sudo, and then delete every file that was created when running the script. You may want to comment out everything below makepkg.

As I said before, FFMPEG is a very fast moving target, so this setup will only work for a short time. I will try to stay on top of this until the SOC stuff is merged into Trunk.

One last warning: If you haven't used a recent version of FFMPEG, there have been changes in the user interface. For instance, you cannot currently use 'h264' as a video codec to invoke x264; you will have to use libx264 instead. There are a bunch of changes like this in the usage.

The files can be grabbed from here:

http://www.mediamax.com/skottish/Hosted … ac3.tar.gz

If something is wrong, or you have any questions, I'll try to check in when I can. I'll also add more SOC stuff if there is enough interest.

Offline

#19 2007-10-03 12:09:39

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: FFMPEG successfully reverse engineered RV30/RV40!

hussam wrote:

I do however fear that those SOC patches will stop being maintained now that the summer is over. It's a pity. hmm

This is just an update. 2007 GSoC is over of course, and there hasn't been any updates to the SoC subversion tree in a few weeks. This is the wrap up:

http://guru.multimedia.cx/googles-summer-of-code-2007/

There has been more code submitted for review for the RV30/40 stuff alone as recently as yesterday, 2007/10/02:

http://lists.mplayerhq.hu/pipermail/ffm … 36132.html

I would not expect anything else from the SoC tree, but I would expect to see much more advanced code being folded into SVN any day now.

Offline

Board footer

Powered by FluxBB