Page 1 of 2

Using FFMPEG To Record Video & Sound in Puppy

Posted: Wed 11 Jan 2012, 08:46
by Icyos
Hi All

Hope someone can help me can anyone please post the code for recording audio & video in any Puppy using FFMPEG from the command line, I can get it to work in Ubuntu but not in Puppy, I have managed to record video only in MacPup but no sound.

Must be easy but I cannot find any reference to it on the forums, many thanks all.

By using the following I can record video ONLY, can someone please add the audio bit please.

#!/bin/sh
var="$(xrandr | grep '*')"
IFS=" "
set -- $var
ffmpeg -f x11grab -s $1 -r 25 -i :0.0 -sameq /root/test.mpg

Thanks all so much.

Posted: Wed 11 Jan 2012, 15:19
by zigbert
I have seldom seen a ffmpeg compile for Puppy including x11grab.
Could it be the size ???? I don't know


Sigmund

Posted: Wed 11 Jan 2012, 19:03
by Icyos
Hi

The above when pasted into a terminal window records video no problem I just need to add sound and the -i pulse command dont work for me which is used in Ubuntu, wonder if -i alsa may work???

Posted: Wed 11 Jan 2012, 19:18
by Barkin
I saw something in the Audacity manual which may give a clue ...
It is not necessary to use Audacity to record sounds playing on the computer. You can capture the sound from the application producing it before it reaches the sound device, which avoids capturing unwanted system sounds. This solution can be used even if there is no sound device. Note: this solution may not work on a system using PulseAudio but you can use PulseAudio Volume Control instead.

First you need to create (or edit if it exists) ~/.asoundrc file. Do it with your favorite plain text editor. Note: ~ is your home directory so change that to /home/john or whatever if you are not working in a Linux shell.

Code: Select all

pcm.teeraw {
   type empty
   slave.pcm "tee:default,'/tmp/out.raw',raw"
   # 48000 S16_LE 2ch (aplay -t raw -f dat)
}
Now tell the application you are trying to record from to use the "teeraw" ALSA device for playback
http://wiki.audacityteam.org/wiki/Recording_audio_playing_on_the_computer#Using_the_ALSA_PCM_file

Posted: Wed 11 Jan 2012, 21:01
by postfs1

Posted: Thu 12 Jan 2012, 04:37
by Icyos
Hi All

Well I am delighted to tell you all I have cracked it this subject is now solved after 2 days I can finally use FFMPEG from the command line to make my screencasts in any version of PUppy.

Thanks everyone again I so love Puppy and this community.

Posted: Thu 12 Jan 2012, 07:55
by Barkin
Icyos wrote:Well I am delighted to tell you all I have cracked it this subject is now solved after 2 days I can finally use FFMPEG from the command line to make my screencasts in any version of PUppy.
I for one would be delighted to learn of this solution, can you tell us about it ?

Posted: Thu 12 Jan 2012, 08:15
by Icyos
Really aww bless you well i could tell you but I would have to kill you...........giggles sorry I am so happy i could burst, the problem was finding a universal command for ffmpeg which i could use for making me screencasts as I hate running puppies from virtual box, as most puppy distros come with ffconvert (ffmpeg) already installed as standard its the perfect soloution.

However unlike the Ubuntu operating system you cannot include the -i pulse bit in the command line as it wrecks it all.

So after messing around with all possible options and spending time on the ffmpeg help pages I finally got it right, through luck more than anything else, I can now use FFMPEG in all me screencasts and recordmydesktop and xvidcap are needed no more woop.

Oh yea I suppose you want the code.......giggles.............here it comes enjoy.

#!/bin/sh
var="$(xrandr | grep '*')"
IFS=" "
set -- $var
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $1 -r 25 -i :0.0 -sameq /root/test.avi

Just bash that in to your terminal and ffmpeg will start recording your desktop and sound at the same time, to end the recording just press CTRL+C.

I am so happy I could go bang :)

Posted: Thu 12 Jan 2012, 09:26
by Barkin
The code you put in your first post ("test.mpg") did enable me to record the desktop, with error messages, but the code in your last post ("test.avi") just generated error messages (attached). I'm using 525 kernel 2.6.33.2

Posted: Thu 12 Jan 2012, 09:47
by Icyos
Hi yes the reason is you have a ?-f remove the question mark please and you will be fine.

#!/bin/sh
var="$(xrandr | grep '*')"
IFS=" "
set -- $var
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $1 -r 25 -i :0.0 -sameq /root/test.avi

Please use above code as is I have tried this on slacko 5.31 & Racy 5.2.2 I will try 5.25/5.28 today, I do assure you it works if you check me youtube site you will see todays video is made with ffmpeg.

Posted: Thu 12 Jan 2012, 16:25
by Barkin
Icyos wrote:... remove the question mark please and you will be fine.
Jesus H. tap-dancing Christ, it works !

and the frame-rate is a lot faster (smoother) than the video captured with the “test.mpg

Posted: Thu 12 Jan 2012, 19:23
by Icyos
Giggles..................you are so welcome and yes it is smooth isnt it and it comes as standard in most Puppy distros, you really cant beat a Pup.

Anymore issues just let me know till then enjoy.

Using FFMPEG To Record Video & Sound in Puppy

Posted: Tue 13 Mar 2012, 12:21
by bill
Topic of your code at : http://www.murga-linux.com/puppy/viewto ... 98&t=75113

Hello icyos,I am running 3.3 Lucid Puppy Version :Lupu-520 Kernel :2.6.33.2 Alsa HDA NVidia Realtek ALC888
I lucked out with no problems installing the bash vidcap.sh but on execution I received the following screen :
Might you be able to tell me where I took the wrong turn ? Thanks in advance bill-Texas USA

Using FFMPEG To Record Video & Sound in Puppy

Posted: Mon 19 Mar 2012, 21:54
by bill
For anyone doing Bash script for ffmpeg/alsa and get error message"cannot set
channel count to 1" hw:0,0 input/output error try changing hw:0,0 to plughw:0,0

Posted: Tue 20 Mar 2012, 00:56
by Lobster
I have added a front end to the script
- tested in Slacko
should work in Lucid, Wary, Racy and other Puppy's with ffmpeg
Files recorded are incremented automatically

Here is a youtube tutorial for Puppy hacker school students, truants and future and present tutors
http://youtu.be/gUwMCMjVXL8

Posted: Tue 20 Mar 2012, 10:24
by Barkin
Lobster wrote:I have added a front end to the script
- tested in Slacko
should work in Lucid, Wary, Racy and other Puppy's with ffmpeg
Just tested your GUI in Lucid puppy 525, kernel 2.6.33.2 , it works.

[ For the uninitiated the video is saved in the same directory as the app ].

Posted: Tue 20 Mar 2012, 10:47
by Lobster
Thanks Barkin - edited my post to include a youtube tutorial on how the front end program was created
http://youtu.be/gUwMCMjVXL8

Posted: Tue 20 Mar 2012, 11:04
by Barkin
Lobster wrote:Thanks Barkin - edited my post to include a youtube tutorial on how the front end program was created
http://youtu.be/gUwMCMjVXL8
The audio in your youtu.be video is only in my left ear.

[ It's not due to the pup-rec app as that gives me stereo when I used it to record my desktop ]

Posted: Tue 20 Mar 2012, 11:37
by Lobster
That is convenient - you can listen to music of your choice with your right ear . . . :wink:

Posted: Tue 20 Mar 2012, 12:43
by antiloquax
I am currently using Racy 5.2.9 and I am getting an error:

Code: Select all

unknown input format: 'x11grab'
:oops:
Which is a shame, because I wanted to use this ...

Great video by the way Lobster!