Notices


Reply
Thread Tools
Posts: 87 | Thanked: 46 times | Joined on Nov 2010 @ lisbon, portugal
#1
Did anyone managed to grab video AND audio with mencoder???

I've been trying for a long time without success. I can grab video but when I add audio to the stream mecoder fails with error.

This is the basic mencoder cmd that I use at my eepc and works fine:
mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0:forceaudio:alsa:adevice=hw.0,0 -ovc lavc -oac copy -o test.avi

in N900 this is what happens
Nokia-N900:~# mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0:forceaudio:alsa:adevice=hw.0,0 -ovc lavc -oac copy -o test.avi -v -v -v
MEncoder SVN-r30099-4.2.1 (C) 2000-2009 MPlayer Team
this_opt = option: v
Setting v=(null)
Configuration: --prefix=/usr --extra-cflags=-mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp --disable-speex --disable-dvdnav --disable-dvdread --disable-dvdread-internal --disable-real --disable-xanim
init_freetype
Using Unoptimized OnScreenDisplay
Config pushed level is now 2
Config pushed level is now 3
Setting tv=driver=v4l2:width=320:height=240:device=/dev/video0:forceaudio:alsa:adevice=hw.0,0
STREAM: [tv] tv://
STREAM: Description: TV Input
STREAM: Author: Benjamin Zores, Albeu
STREAM: Comment:
success: format: 9 data: 0x0 - 0x0
s->pos=0 newpos=0 new_bufpos=0 buflen=0
TV file format detected.
Selected driver: v4l2
name: Video 4 Linux 2 input
author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
comment: first try, more to come ;-)
v4l2: video fd: /dev/video0: 3
Selected device: omap3/et8ek8/ad5820/adp1653
Capabilites: video capture streaming
supported norms:
inputs: 0 = camera;
Current input: 0
Format UYVY (16 bits, UYVY, packed): Packed UYVY
Format YUYV (16 bits, YUYV (YUV 4:2:2), packed): Packed YUY2
Format unknown (0x30314142) ( 0 bits, Bayer10 (GrR/BGb)): Unknown 0x30314142
Current format: YUYV
v4l2: set format: YVU420
v4l2: set input: 0
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
Selected norm : pal
v4l2: ioctl enum norm failed: Invalid argument
Error: Cannot set norm!
v4l2: set width: 320
v4l2: set height: 240
Selected input hasn't got a tuner!
==> Found video stream: 0
v4l2: get format: YUYV
v4l2: Cannot get fps
v4l2: get width: 320
v4l2: get height: 240
Hardware PCM card 0 'RX51' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 16
buffer_size : 32768
period_size : 512
period_time : 11609
tstamp_mode : NONE
period_step : 1
avail_min : 512
period_event : 0
start_threshold : 0
stop_threshold : 32768
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
v4l2: set audio samplerate: 44100
Hardware PCM card 0 'RX51' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 16
buffer_size : 32768
period_size : 512
period_time : 11609
tstamp_mode : NONE
period_step : 1
avail_min : 512
period_event : 0
start_threshold : 0
stop_threshold : 32768
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
v4l2: get audio format: 9
==> Found audio stream: 0
v4l2: get audio samplerate: 44100
v4l2: get audio samplesize: 2
v4l2: get audio channels: 2
TV audio: 2 channels, 16 bits, 44100 Hz
Audio capture - buffer 2671 blocks of 2048 bytes, skew average from 87 meas.
Floating point exception



Anyone??
 
Posts: 560 | Thanked: 422 times | Joined on Mar 2011
#2
When you say "grab", which do you mean: download or encode?

ffmpeg is considered to work well by many for encoding, but at the moment I'm having trouble with its apparently absent libx264 encoder.
 
Posts: 87 | Thanked: 46 times | Joined on Nov 2010 @ lisbon, portugal
#3
grab=capture from cam (/dev/video0 or /dev/video1) and mic and consequently encode that to an mp4/avi file.

Regarding ffmpeg I'm having stange behaviours:

ffmpeg -f alsa -ac 2 -i hw:0 -f video4linux2 -i /dev/video0 -acodec ac3 -ab 128k -vcodec mpeg4 -b 6000k -r 25 test5.avi

ffmpeg -f alsa -ac 2 -i hw:0 -f video4linux2 -s 320x240 -i /dev/video0 -acodec ac3 -ab 128k -vcodec mpeg4 -b 6000k -r 25 test5.avi

ffmpeg -f alsa -ac 2 -i hw:0 -f video4linux2 -s 320x240 -i /dev/video1 -vcodec libx264 -acodec libfaac test.mp4

ffmpeg -f alsa -ac 2 -i hw:0 -f video4linux2 -s 320x240 -i /dev/video1 test.mp4


none of these produced any file and in the top of that, when /dev/video0 is specified my phone reboots.
When /dev/video1 is specified, nothing happens, I can see the front red light but no file is produced also.
 
Posts: 560 | Thanked: 422 times | Joined on Mar 2011
#4
There are two/three processes here:
A 1. Record video, i.e. the capture and storage of visual infomation
A 2. Record sound i.e. the capture and storage of auditory information.
B. Encode audio-video, i.e. transformation and combination of data from at least one source and configuration into another.


Aside from whether the device is up to doing all of this at once, you need to ensure both the recording and encoding processes are operating before you can try to join them up.

Re: encoding
On you N900, what software do you have installed capable of encoding videos? What formats is it capable of producing?
Tests:
- Try simply changing a pre-recorded video from one format to another.
- Try combining a pre-recorded sound track with a pre-recorded video file.
** can you synchroise the two files well enough for tv playback?

re Recording:
- Are you actually capturing visual information?
- If so, is this data being stored for more than 1 frame?
- once you know the data is being stored, try encoding it offline (once record is complete)
- if recording sound with video rolling is a problem, try something like "recaller" and tying the audio and video together with ffmpeg (or similar).

-post 200
 
Posts: 4 | Thanked: 9 times | Joined on Aug 2011
#5
Your best bet would be to use gstreamer, as it has access to the dsp acceleration for encoding to h.264. First you will need to install "gstreamer0.10-tools"

This (single) line should get you started:
Code:
gst-launch v4l2camsrc device=/dev/video0 ! dsph264enc ! avimux ! filesink location=test.avi
I know this might look confusing, but gstreamer does for video and audio what bash does stdin and stdout. To break this command down:
  1. Get video input from camera
  2. Encode it to h264 using the dsp
  3. mux it to avi format
  4. store to a file
    Now that you can get video encoded by the dsp, basic searches on the web will help you do the reset, e.g. how to get audio, and mux it into the same avi file. You can also display the video while it is encoding.

    Enjoy.
    P.S. if you know how to adjust the colours and focus of the camera let me know.



Last edited by brandon; 2011-08-27 at 00:55. Reason: format of text
 

The Following User Says Thank You to brandon For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 11:42.