Using FFMPEG To Record Video & Sound in Puppy

Audio editors, music players, video players, burning software, etc.
Message
Author
Icyos

Using FFMPEG To Record Video & Sound in Puppy

#1 Post 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.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#2 Post by zigbert »

I have seldom seen a ffmpeg compile for Puppy including x11grab.
Could it be the size ???? I don't know


Sigmund

Icyos

#3 Post 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???

User avatar
Barkin
Posts: 803
Joined: Fri 12 Aug 2011, 04:55

#4 Post 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


Icyos

#6 Post 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.

User avatar
Barkin
Posts: 803
Joined: Fri 12 Aug 2011, 04:55

#7 Post 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 ?

Icyos

#8 Post 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 :)

User avatar
Barkin
Posts: 803
Joined: Fri 12 Aug 2011, 04:55

#9 Post 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
Attachments
red error messages with ''test,mpg'' recording of desktop.jpg
successful recording of desktop "test.mpg", generated red error messages.
(112.49 KiB) Downloaded 1189 times
Monster error message.png
screengrab of urxvt, failed ''test.avi''
(80.25 KiB) Downloaded 1066 times

Icyos

#10 Post 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.

User avatar
Barkin
Posts: 803
Joined: Fri 12 Aug 2011, 04:55

#11 Post 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

Icyos

#12 Post 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.

bill
Posts: 490
Joined: Wed 28 May 2008, 15:32

Using FFMPEG To Record Video & Sound in Puppy

#13 Post 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

bill
Posts: 490
Joined: Wed 28 May 2008, 15:32

Using FFMPEG To Record Video & Sound in Puppy

#14 Post 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

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#15 Post 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
Attachments
recgui.zip
(938 Bytes) Downloaded 1645 times
Last edited by Lobster on Tue 20 Mar 2012, 10:30, edited 1 time in total.
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Barkin
Posts: 803
Joined: Fri 12 Aug 2011, 04:55

#16 Post 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 ].

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#17 Post by Lobster »

Thanks Barkin - edited my post to include a youtube tutorial on how the front end program was created
http://youtu.be/gUwMCMjVXL8
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Barkin
Posts: 803
Joined: Fri 12 Aug 2011, 04:55

#18 Post 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 ]

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#19 Post by Lobster »

That is convenient - you can listen to music of your choice with your right ear . . . :wink:
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
antiloquax
Posts: 405
Joined: Fri 27 Jan 2012, 09:17

#20 Post 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!
My System:Arch-Arm on RPi!
"[url=http://murga-linux.com/puppy/viewtopic.php?t=76049l]RacyPy[/url]" puplet on Toshiba Tecra 8200. PIII, 256 MB RAM.
[url=http://raspberrypy.tumblr.com/]RaspberryPy[/url]: Lobster and I blog about the RPi.

Post Reply