LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-08-2013, 08:36 AM   #1
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 425
Blog Entries: 28

Rep: Reputation: 2
recording sound from pcm along with tv by mencoder


Hi, I found that this code records the signal of tv tuner:
Code:
#!/bin/bash
sox -t alsa hw:1,1 -t alsa hw:0,0 &

if [ $# -ne 3 ]
then
        echo "Usage: $0 channel seconds filename"
        exit
fi

WIDTH=640
HEIGHT=480
MENCODER=/usr/bin/mencoder
AUDIO="-oac pcm:file=/home/ted/file.wav -lameopts cbr:br=128:mode=3"
VIDEO="-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=6400"
DSP="alsa:adevice=hw.0:forceaudio:amode=2:audiorate=44100:forceaudio:immediatemode=0"
TV=" -tv driver=v4l2:width=$WIDTH:height=$HEIGHT:outfmt=yuy2:input=0:device=/dev/video0:norm=NTSC:chanlist=us-cable:channel=$1:$DSP"
$MENCODER tv:// $TV $VIDEO $AUDIO -endpos $2 -ffourcc divx -o  "$3.avi"

pid=$(ps aux | pgrep "^sox")
kill $pid & exit
but the sound isnt recorded correctly. The tv tuner card comes out thru this binding:
Code:
sox -t alsa hw:1,1 -t alsa hw:0,0
The above line allows the sound of sound card to comeout from the speaker
So I thought it has to do with line-in, http://inspirated.com/2007/04/05/als...e-with-mplayer.
But I followed everything on the blog but nothing worked. I must have done something incorrectly.
Thanks,
Ted
 
Old 09-12-2013, 10:35 AM   #2
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,854

Rep: Reputation: 237Reputation: 237Reputation: 237
Quote:
TV=" -tv driver=v4l2:width=$WIDTH:height=$HEIGHTutfmt=yuy2:input=0:device=/dev/video0:norm=NTSC:chanlist=us-cable:channel=$1:$DSP"
Lets start with some info.
Are you trying to record an analog NTSC TV broadcast, or a digital broadcast?
Do you want to capture the audio that is coming through your sound card, or the audio portion of the TV broadcast?
Can you play the TV broadcast with mplayer? If so post your command line.
 
Old 09-13-2013, 05:45 AM   #3
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 425
Blog Entries: 28

Original Poster
Rep: Reputation: 2
Thanks for your reply! I am trying to record NTSC TV broadcast with TV tuner card, and the sound input is thru the TV sound card. Although I am not very sure with the exact procedure, but I believe sox -t alsa hw:1,1 -t alsa hw:0,0this binds the TV card to the pcm input of the sound card to play the sound, the sound changes as I switch between channels. Since the sound could be played, I believe its technicallly possible to record the sound input, but not sure about whether I could get the sound in the same avi file (best if it could) or a separate sound file (if there is no better choice).
So far there is no problem playing TV bc with mplayer and the picture sound both show up fine. I could now record picture with mencoder but not with the sound.
Code:
WIDTH=640
HEIGHT=480
MPLAYER=/usr/bin/mplayer
AUDIO="-oac pcm:file=/home/ted/file.wav -lameopts cbr:br=128:mode=3"
VIDEO="-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=6400"
DSP="alsa:adevice=hw.0:forceaudio:amode=2:audiorate=44100:forceaudio:immediatemode=0"
TV=" -tv driver=v4l2:width=$WIDTH:height=$HEIGHT:outfmt=yuy2:input=0:device=/dev/video0:norm=NTSC:chanlist=us-cable:channel=$1:$DSP"
$MPLAYER tv:// $TV $VIDEO $AUDIO -endpos $2 -ffourcc divx -o  "$3.avi"
Thanks,Ted

Last edited by ted_chou12; 09-13-2013 at 05:50 AM.
 
Old 09-13-2013, 08:30 AM   #4
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,854

Rep: Reputation: 237Reputation: 237Reputation: 237
Quote:
So far there is no problem playing TV bc with mplayer and the picture sound both show up fine
How about
Code:
$MPLAYER tv:// .....-dumpstream -dumpfile output.avi
If mplayer can play it, you can dump it's output to file.

The audio from the tv card goes in to the sound card... You could make a loopback device and capture what is coming through line in, or what's coming out of the speakers.

A couple of threads.
http://www.alsa-project.org/main/ind...x:Module-aloop
https://bbs.archlinux.org/viewtopic.php?pid=1308977
https://bbs.archlinux.org/viewtopic.php?id=147852

EDIT: Upon closer reading,
These don't go together
Code:
-oac pcm:file=/home/ted/file.wav -lameopts cbr:br=128
That would need to need to be
Code:
-oac mp3lame -lameopts cbr:br=128

Last edited by teckk; 09-13-2013 at 09:01 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mencoder stopped recording sound with PCTV jmfv Linux - Software 0 03-23-2009 08:02 AM
Recording from PCM drauk Slackware 1 09-25-2007 03:36 PM
Mencoder for recording TV from a 878 tv card. glore2002 Linux - Software 7 03-21-2007 07:27 PM
Recording Video and Audio using mencoder OR13 Linux - Desktop 3 01-19-2007 04:19 PM
Recording PCM audio - SUSE 10 tanke Linux - Newbie 1 01-19-2006 02:19 AM


All times are GMT -5. The time now is 01:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration