Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: Trying to get a ``polished'' MPEG stream from DVB



Hi,

Jim Darby wrote:

I can't be the only one trying to transcode DVB output. What does
everyone else do?

I had something similar with replex. I'd get a whole series of these errors, followed by something like:
ringbuffer overflow 132<184 629145
ring buffer overflow 629145

My workaround was to use mencoder something like:
cat /dev/dvb/adapter0/dvr0 | mencoder -of mpeg -ovc copy -oac copy - -o ps.mpg

This worked well, except when the cat received errors from the dvr device -- this would stop my recording, as cat would exit. I worked around that by writing a small C program, imaginatively called dvrcat, that simply logged the errors to stderr, and ignored them. This setup has been working for me for a couple of months, producing program streams that work well with mplayer, VideoLAN and WinDVD.

I've recently added -tskeepbroken to the mencoder command-line, as I had a problem once, where mencoder got confused and quit before it's stdin had been closed.


Chris Chatfield wrote:

I'm trying to write one in my spare time. It's going a bit slowly at the
moment :(
That was my grand plan a couple of months ago too, but since the mencoder thing has been working for me, it got put on hold.

Cheers,
Marty.

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>

unsigned char buffer[188 * 10000];

int main(int argc, char *argv[])
{
FILE *err = fdopen(STDERR_FILENO, "w");
if (argc < 2)
{
fprintf(err, "Usage: dvrcat <dvr-device>\n");
return 1;
}

int dvrFd = open(argv[1], O_RDONLY);
if (dvrFd == -1)
{
fprintf(err, "Error: %s: %s\n", argv[1], strerror(errno));
return 2;
}

while (1)
{
int bytesRead = read(dvrFd, buffer, sizeof buffer);
if (bytesRead == -1)
{
fprintf(err, "Warning: %s: %s\n", argv[1], strerror(errno));
continue;
}
if (bytesRead == 0)
break;

int bytesWritten = write(STDOUT_FILENO, buffer, bytesRead);
if (bytesWritten != bytesRead)
{
if (bytesWritten == -1)
fprintf(err, "Error copying to output: %s: %s\n", argv[1], strerror(errno));
else
fprintf(err, "Bytes written != bytes read: %s (%d, %d)\n", argv[1], bytesWritten, bytesRead);
}
}

return 0;
}



--
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index