[MEncoder-users] record from camera to quicktime-compatible format

Christine Deignan christine at pepper.com
Fri Mar 30 03:04:41 CEST 2007


Hi,
 
I am using mencoder version 1.0pre8, and trying to record video and 
audio from a camera and microphone to a basic quicktime-compatible 
format.  I would like to use mpeg4 video and the fastest possible audio 
encoder.  The closest I've been able to get to something that works 
reliably is to record from the camera thusly:
 
    mencoder tv:// -tv 
driver=v4l2:device=/dev/video0:normid=2:forceaudio:adevice=/dev/audio 
-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=200:vglobal=1:aglobal=1 -sws 0 
-vf scale=320:240,mirror=on -oac lavc -lavcopts acodec=aac:abitrate=16 
-o test.avi -ffourcc XVID
 
and then transcode it to a .mp4 (recording straight to a .mp4 has 
resulted in broken files):
 
mencoder test.avi -ovc copy -oac copy -ffourcc mp4v -of lavf -lavfopts 
format=mp4:i_certify_that_my_video_stream_does_not_use_b_frames -o test.mp4
 
However, the aac audio encoder is too slow, and I'd really like to skip 
the second step (although it is quite fast).
 
I've looked at videos recorded from a little Canon Powershot camera.  
They are in .avi format, with uncompressed pcm audio, and they play fine 
in quicktime.  However I can't get pcm audio to work at all in quicktime 
(even after the above transcode step), and I haven't figured out how to 
get .avi files to run as-is, even with no audio (I removed 
vglobal=1:aglobal=1 for .avi).  Here is how I recorded to pcm audio:
 
mencoder tv:// -tv 
driver=v4l2:device=/dev/video0:normid=2:forceaudio:adevice=/dev/audio:audiorate=11024 
-af channels=1 -ovc lavc -lavcopts 
vcodec=mpeg4:vbitrate=200:vglobal=1:aglobal=1 -sws 0 -vf 
scale=320:240,mirror=on -oac pcm -o test.avi -ffourcc XVID
 
I've also tried a fourcc of mjpg, which is what the Canon uses.
 
Any advice on how to get uncompressed pcm audio (or mp2 or ac3) to work 
with basic quicktime?  That's the more important goal.  A second step to 
transcode the audio to aac does work but it takes way too long.
 
Also a one-step encode to either .avi or .mp4 is highly desireable.
 
I have run mplayer with -msglevel all=9 to get as much info as I can on 
the videos.  There are some differences between the Canon and the ones I 
recorded, I have not been able to get them to be identical.  Here is the 
header information from the Canon and from a video I recorded:
 
Canon:
 
CHUNK avih  len=56
======= AVI Header =======
us/frame: 66666  (fps=15.000)
max bytes/sec: 136154
padding: 0
MainAVIHeader.dwFlags: (65552) HAS_INDEX WAS_CAPTUREFILE
frames  total: 182   initial: 0
streams: 2
Suggested BufferSize: 11024
Size:  160 x 120
==========================
list_end=0x15A  pos=0x58  chunksize=0x0  next=0x58
LIST strl  len=116
list_end=0xD4
CHUNK strh  len=56
==> Found video stream: 0
====== STREAM Header =====
Type: vids   FCC: mjpg (67706A6D)
Flags: 0
Priority: 0   Language: 0
InitialFrames: 0
Rate: 1000000/66666 = 15.000
Start: 0   Len: 182
Suggested BufferSize: 8342
Quality 10000
Sample size: 0
==========================
list_end=0xD4  pos=0xA4  chunksize=0x0  next=0xA4
CHUNK strf  len=40
Found 'bih', 40 bytes of 40
======= VIDEO Format ======
  biSize 40
  biWidth 160
  biHeight 120
  biPlanes 1
  biBitCount 24
  biCompression 1196444237='MJPG'
  biSizeImage 57600
===========================
list_end=0xD4  pos=0xD4  chunksize=0x0  next=0xD4
LIST strl  len=92
list_end=0x138
CHUNK strh  len=56
==> Found audio stream: 1
====== STREAM Header =====
Type: auds   FCC:  (0)
Flags: 0
Priority: 0   Language: 0
InitialFrames: 0
Rate: 11024/1 = 11024.000
Start: 0   Len: 133758
Suggested BufferSize: 11024
Quality 10000
Sample size: 1
==========================
list_end=0x138  pos=0x120  chunksize=0x0  next=0x120
CHUNK strf  len=16
Found 'wf', 16 bytes of 18
======= WAVE Format =======
Format Tag: 1 (0x1)
Channels: 1
Samplerate: 11024
avg byte/sec: 11024
Block align: 1
bits/sample: 8
cbSize: 0
==========================================================================
list_end=0x138  pos=0x138  chunksize=0x0  next=0x138
CHUNK IDIT  len=26
hdr=Digitization Time  size=26
Digitization Time: SAT MAR 11 20:56:08 2006
                                                                                                                                                                                                                                                 
 
 
 
 
My video:
CHUNK avih  len=56
======= AVI Header =======
us/frame: 66733  (fps=14.985)
max bytes/sec: 0
padding: 0
MainAVIHeader.dwFlags: (2320) HAS_INDEX IS_INTERLEAVED TRUST_CKTYPE
frames  total: 63   initial: 0
streams: 1
Suggested BufferSize: 0
Size:  320 x 240
==========================
list_end=0xD4  pos=0x58  chunksize=0x0  next=0x58
LIST strl  len=116
list_end=0xD4
CHUNK strh  len=56
==> Found video stream: 0
====== STREAM Header =====
Type: vids   FCC: mjpg (67706A6D)
Flags: 0
Priority: 0   Language: 0
InitialFrames: 0
Rate: 15000/1001 = 14.985
Start: 0   Len: 63
Suggested BufferSize: 6036
Quality 0
Sample size: 0
==========================
list_end=0xD4  pos=0xA4  chunksize=0x0  next=0xA4
CHUNK strf  len=40
Found 'bih', 40 bytes of 40
======= VIDEO Format ======
  biSize 40
  biWidth 320
  biHeight 240
  biPlanes 1
  biBitCount 24
  biCompression 1735420525='mjpg'
  biSizeImage 230400
===========================
list_end=0xD4  pos=0xD4  chunksize=0x0  next=0xD4
LIST INFO  len=34
list_end=0xFE
CHUNK ISFT  len=22
hdr=Software  size=22
Software  : MEncoder 1.0rc1-3.4.4
list_end=0xFE  pos=0xFE  chunksize=0x0  next=0xFE
CHUNK JUNK  len=3834
list_end=0x0  pos=0x1000  chunksize=0x0  next=0x1000
LIST movi  len=214870
list_end=0x3575E
Found movie at 0x100C - 0x3575E
 
 
 
Thanks
Christine




More information about the MEncoder-users mailing list