[mythtv] First crack at transcode patch

Geoffrey Hausheer ou401cru02 at sneakemail.com
Sat Apr 5 10:45:54 EST 2003


NOTE:  THIS PATCH IS NOWHERE NEAR READY FOR GENERAL CONSUMPTION!!!!

I am including my first attempt at a transcoding patch.  This patch
merely updates NuppelVideoPlayer::ReencodeFile, but I am looking for
feedback on seperation and perhaps a more elegant way to do it.

The final goal is to be able to convert from any nuv format to any other
nuv format, which means (re)encoding audio, changing bitrates, saving to
either RTJpeg or MPEG4...as well as doing frame processing (changing
resolution, deinterlacing, etc)

The current patch can change bitrates or convert from RTJpeg to MPEG4 (so
in otherwords it has the same functionality that ReencodeFile had
originally), but does not try to do any frame-processing, and purely
copies the audio (and the original must be in mp3 format)

Anyhow, I tried to use NuppelVideoRecorder to do all the encoding, as
this prevents needing to duplicate the encoding code.  This involves
exporting WriteVideo (And eventually WriteAudio), and SetupAVCodec (which
may not be ideal).

Anyhow, I'd like to get feedback if I'm going about this in a sane
manner.  Also, I have a question about the avcodec mutex-lock in
WriteVideo...what is the point of that?  It seems to be global to all
nvr's, which I don't understand.  Why can't two capture cards encode at
the same time?  For the transcoder, I will want to disable the lock,
since the transcoding is meant to be done in the background at low
priority; perhaps while capture is going on, and I don't want to lock out
the important thread with my transcoding.  Anyhow, I need to understand
what the lock is protecting against.

I am including a stupid little utility that calls the transcoder, which
encodes to the 'Default' profile (which is useless so don't think of
using it for anything other than testing)

Thanks,
.Geoff


-- 
  Geoffrey Hausheer
  XXXXXXXXXXXXXXXXXXXXX
-------------- next part --------------
z'µìmjÛZržžÜ²Ç+¹¶ÞtÖ¦zÚÚžÇ(uêZµÈSÊ—š¦™bq«b¢îžIèÂt¢ÍízëO[Ê׬
ë
ž‹Z½¨¥i¹^R¹¦*^®f¢—ö­µ§!™éí³ý´Ó}8ÓŸøñÇv{§¿¶¶§±Ê
y¸§-------------- next part --------------
#include <qapplication.h>
#include <qsqldatabase.h>
#include <qfile.h>
#include <qmap.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <iostream>
#include <fstream>
using namespace std;

#include "NuppelVideoPlayer.h"
#include "recordingprofile.h"
#include "libmyth/mythcontext.h"
MythContext *gContext;

int main(int argc, char *argv[])
{
    char *in, *out;
    srand(time(NULL));

    QApplication a(argc, argv);
    in = a.argv()[1];
    out = a.argv()[2];
    printf("%s -- %s\n",in, out);
    //  Load the context
    gContext = new MythContext();
    QSqlDatabase *db = QSqlDatabase::addDatabase("QMYSQL3");
    if (!db)
    {
        printf("Couldn't connect to database\n");
        return -1;
    }
    if (!gContext->OpenDatabase(db))
    {
        printf("couldn't open db\n");
        return -1;
    }
    gContext->LoadQtConfig();

    RecordingProfile profile;
    MythContext::KickDatabase(db);

    profile.loadByName(db, "Default");
    NuppelVideoPlayer *nvp = new NuppelVideoPlayer;
    nvp->ReencodeFile(in, out, profile);
    return 0;
}


More information about the mythtv-dev mailing list