Chris Cherrett
July 3rd, 2007, 01:16 AM
//////////////////////////////////////////////////////////////////////////////////////////////////
Summary: Command used to capture/monitor live video in Linux
//////////////////////////////////////////////////////////////////////////////////////////////////
To Monitor:
mpg1394grab | mpeg2dec -t 4096
To Capture:
mpg1394grab > testfile.mpg
//////////////////////////////////////////////////////////////////////////////////////////////////
I decided to write this thread based on my frustrations from this thread:
http://www.dvinfo.net/conf/showthread.php?t=97953
I will work on this thread as time goes on in order to provide the best most up-to-date information available.
I have been working on getting Linux working with my JVC GY-HD100 for about a month or so now. I have had some good success today and thought I would start a thread to share it. I use 100% Open Source software for all my graphics work (raster,vector,3D,flash). For the most part I am just getting video in Linux and find it a fantastic journey!
Software Used: (this is not a full list yet but I will get into that soon)
Blender
Cinelerra
mpginfo
mpg1394grab
mpeg2dec
mplayer
vlc
gimp
For now I am not going to talk about NLE or Compositing but that will come soon!
(place holder for NLE and compositing talk)
While trying to figure out a low cost solution to a focus field monitor for my camera I stumbled upon a few good solutions for getting HDV video to write to my hard drive and use my laptop as a reference monitor.
The solutions were not the easiest and HDV is a highly uncharted venture in Linux but it is possible with 100% open source software.
1. Capturing Video:
I found this program called mpg1394grab at the following url:
http://www.kinodv.org/filemanager/download/5/mpg1394grab.c
It needed to be compiled with the gcc compiler which is in most Linux distributions by default.
the program is simple. It looks to your /dev/raw1394 device (firewire device on linux) for a mpeg2 stream. If it sees one then it writes it to disk.
mpg1394grab > somempegfile.mpg
will start the program listening to the /dev/raw1394 firewire device on your computer. When you hit REC on your camera (or PLAY if you are in VTR mode) mpg1392mpg will start to write the file to your computer.
2. Monitoring (NOTE: this solution has a .5 second delay on my p4 2.4, 1GB RAM. I am sure that would be different with newer hardware.)
The best option I have found for monitoring so far is to use the mpg1394grab program and pipe ( this symbol -> |, pipe is shift+backslash) to mpeg2dec. mpeg2dec is a simple comandline program that can take a mpeg2 stream and play it back for live monitoring.
The command is like this:
mpg1394grab | mpeg2dec -t 4096
At this point you should be seeing the output from your camera.
A few words about mpeg2dec:
- the t option states:
-t use transport stream demultiplexer, pid 0x10-0x1ffe
I don't fully understand this yet but after some digging I ran a program called mpginfo like this on an existing file and found some information:
mpginfo testfile.mpg
this outputted the line:
Stream 3: MPEG 2 video [pid: 4096]
this is the whole output:
Skipped -2 zeroes at start of file
mpgtx: AT EOF - please stop me!
mmm, this file does not start with a pack, offset: -2
use the desperate_mode switch as the first option -X to search for a header in the whole file!
if you want to force the operation. May yield to an endless loop if no valid header is found!
Does not even begin with a 00 00 01 xx sequence!
No success at all.
testfile.mpg
Mpeg 2 Transport Stream [1 program]
Program N° 1 contains 3 Elementary Streams:
maybe scrambled (CA ID 65535)
1 additional descriptor was not handled
Stream 1: User Private data [pid: 3842]
Stream 2: MPEG 1 audio [pid: 4098]
1 additional descriptor was not handled
Stream 3: MPEG 2 video [pid: 4096]
video version 58
1 additional descriptor was not handled
from there I was able to use the PID for the t option and I could view my stream live!
3. Capture and Monitor at the same time:
The easiest way I found was to run the command for monitoring in one terminal window:
mpg1394grab > testfile.mpg
and run the capture command in another window:
mpg1394grab | mpeg2dec -t 409
Now to get a huge external hard drive for the computer and all is well! :)
Summary: Command used to capture/monitor live video in Linux
//////////////////////////////////////////////////////////////////////////////////////////////////
To Monitor:
mpg1394grab | mpeg2dec -t 4096
To Capture:
mpg1394grab > testfile.mpg
//////////////////////////////////////////////////////////////////////////////////////////////////
I decided to write this thread based on my frustrations from this thread:
http://www.dvinfo.net/conf/showthread.php?t=97953
I will work on this thread as time goes on in order to provide the best most up-to-date information available.
I have been working on getting Linux working with my JVC GY-HD100 for about a month or so now. I have had some good success today and thought I would start a thread to share it. I use 100% Open Source software for all my graphics work (raster,vector,3D,flash). For the most part I am just getting video in Linux and find it a fantastic journey!
Software Used: (this is not a full list yet but I will get into that soon)
Blender
Cinelerra
mpginfo
mpg1394grab
mpeg2dec
mplayer
vlc
gimp
For now I am not going to talk about NLE or Compositing but that will come soon!
(place holder for NLE and compositing talk)
While trying to figure out a low cost solution to a focus field monitor for my camera I stumbled upon a few good solutions for getting HDV video to write to my hard drive and use my laptop as a reference monitor.
The solutions were not the easiest and HDV is a highly uncharted venture in Linux but it is possible with 100% open source software.
1. Capturing Video:
I found this program called mpg1394grab at the following url:
http://www.kinodv.org/filemanager/download/5/mpg1394grab.c
It needed to be compiled with the gcc compiler which is in most Linux distributions by default.
the program is simple. It looks to your /dev/raw1394 device (firewire device on linux) for a mpeg2 stream. If it sees one then it writes it to disk.
mpg1394grab > somempegfile.mpg
will start the program listening to the /dev/raw1394 firewire device on your computer. When you hit REC on your camera (or PLAY if you are in VTR mode) mpg1392mpg will start to write the file to your computer.
2. Monitoring (NOTE: this solution has a .5 second delay on my p4 2.4, 1GB RAM. I am sure that would be different with newer hardware.)
The best option I have found for monitoring so far is to use the mpg1394grab program and pipe ( this symbol -> |, pipe is shift+backslash) to mpeg2dec. mpeg2dec is a simple comandline program that can take a mpeg2 stream and play it back for live monitoring.
The command is like this:
mpg1394grab | mpeg2dec -t 4096
At this point you should be seeing the output from your camera.
A few words about mpeg2dec:
- the t option states:
-t use transport stream demultiplexer, pid 0x10-0x1ffe
I don't fully understand this yet but after some digging I ran a program called mpginfo like this on an existing file and found some information:
mpginfo testfile.mpg
this outputted the line:
Stream 3: MPEG 2 video [pid: 4096]
this is the whole output:
Skipped -2 zeroes at start of file
mpgtx: AT EOF - please stop me!
mmm, this file does not start with a pack, offset: -2
use the desperate_mode switch as the first option -X to search for a header in the whole file!
if you want to force the operation. May yield to an endless loop if no valid header is found!
Does not even begin with a 00 00 01 xx sequence!
No success at all.
testfile.mpg
Mpeg 2 Transport Stream [1 program]
Program N° 1 contains 3 Elementary Streams:
maybe scrambled (CA ID 65535)
1 additional descriptor was not handled
Stream 1: User Private data [pid: 3842]
Stream 2: MPEG 1 audio [pid: 4098]
1 additional descriptor was not handled
Stream 3: MPEG 2 video [pid: 4096]
video version 58
1 additional descriptor was not handled
from there I was able to use the PID for the t option and I could view my stream live!
3. Capture and Monitor at the same time:
The easiest way I found was to run the command for monitoring in one terminal window:
mpg1394grab > testfile.mpg
and run the capture command in another window:
mpg1394grab | mpeg2dec -t 409
Now to get a huge external hard drive for the computer and all is well! :)