Re: Riiping DVB .TS file

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

 



juha s. wrote:
> Hi gurus
> 
> 
> I'm using dvbstream to record whole MUX with all PIDs (-o 8192) in it to
> a one file. So I get one big file which I like to decode. I can get
> videos and audios out of file, but is there a way to rip of teletext,
> EPG and SI -information if I know the right pids.
> So, what I really like to do, is to rip out teletext plus
> EPG-information to another file and read those file when I need to
> information from EPG or teletext.
> 
> VLC player doesn't yet support EPG or teletext, but is there any easy
> way or tools to do this or should I just forget it ?
> 
> Thansk advance
> -Jussi
> 
>

Hello

Here's a little program joined

Edit the source and choose the pids you want

Regards

-- 
Brice

http://mumudvb.braice.net
/* A simple filter to extract multiple streams from a
   multiplexed TS.
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <string.h>



int main(int argc, char **argv)
{
  int pid,n;
  int filters[8192];
  unsigned int i=0;
  unsigned int j=0;
  unsigned int k=0;
  unsigned int l=0;
  //  char buf[188];
  unsigned char buf[188];
  unsigned char my_cc[8192];
  int errors=0;
  int nb_bytes=0;
  char *entree_filename = NULL;
  char *sortie_filename = NULL;
  FILE *sortie,*entree;
  int c,option_index=0;

  char eitbuf[4096];

  const char short_options[] = "e:s:";
  const struct option long_options[] = 
    {
      {"entree", required_argument, NULL, 'e'},
      {"sortie", required_argument, NULL, 's'},
      {0, 0, 0, 0}
    };


  while (1)
    {
      c = getopt_long (argc, argv, short_options,
                       long_options, &option_index);
      if (c == -1)
        {
          break;
        }
      switch (c)
        {
        case 'e':
	  entree_filename = malloc (strlen (optarg) + 1);
	  strncpy (entree_filename, optarg, strlen (optarg) + 1);
          break;
        case 's':
	  sortie_filename = malloc (strlen (optarg) + 1);
	  strncpy (sortie_filename, optarg, strlen (optarg) + 1);
          break;
	case 'h':
	  break;
	}
    }
  if (optind < argc)
    {
      fprintf(stderr,"Too few arguments\n Usage : extract_pid -e file_in -s file_out");
      exit(1);
    }


  if (!entree_filename || !sortie_filename)
    {
      fprintf(stderr,"You must specify filenames\n");
      exit(2);
    }


  entree=fopen(entree_filename, "r");
  if (!entree)
    {
      fprintf (stderr,
	       "%s: %s\n",
	       entree_filename, strerror (errno));
      exit(3);
    }
  sortie=fopen(sortie_filename, "w");
  if (!entree)
    {
      fprintf (stderr,
	       "%s: %s\n",
	       sortie_filename, strerror (errno));
      exit(3);
    }


  for (i=0;i<8192;i++) { filters[i]=0; my_cc[i]=0xff;}


  n=fread(buf,1,188,entree);
  i=0;
  while (n==188&&i<2000000)
    {
      if (buf[0]!=0x47)
	{
	  // TO DO: Re-sync.
	  fprintf(stderr,"FATAL ERROR IN STREAM AT PACKET %d\n",i);
	  //      exit;
	}
      pid=(((buf[1] & 0x1f) << 8) | buf[2]);
      if (my_cc[pid]==0xff)
	my_cc[pid]=buf[3]&0x0f;


      //MOdifiy Here to choos your pids
      if((pid==0)||(pid==18))
	{
	  fwrite(buf,1,188,sortie);
	  j++;
	}

      filters[pid]++;
    
      n=fread(buf,1,188,entree);
      i++;
    }
  fclose(sortie);
  fprintf(stderr,"Read %d packets, wrote %d.\n",i,j);
  fprintf(stderr,"%d incontinuity errors.\n",errors);

  return(0);
}




Ce programme permet de récuperer un pid d'un flux Mpeg2-TS met met les paquets a coté, il n'extrait pas les données et c'est bien le probleme .....
_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux