Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 24 Nov 2014, 20:58
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How To Use FFMPEG To Screencast from any Puppy Distro
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [22 Posts]   Goto page: 1, 2 Next
Author Message
Icyos


Joined: 28 Jun 2011
Posts: 92
Location: UK

PostPosted: Thu 12 Jan 2012, 04:23    Post subject:  How To Use FFMPEG To Screencast from any Puppy Distro
Subject description: Tested on 5.25/5.28 & 5.31 Slacko
 

Hi All

If you want to make videos in Puppy Linux to upload to youtube etc, then just open your terminal and bash the following code in.

#!/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

FFMPEG will now record your desktop and your Mic + Sound input as well, just use CTRL+C to end the recording.

This will give you a big file of nice quality, I would suggest you use FFConvert to shrink it down to a few megs so you can upload it quicker to youtube.

This means you dont need to install apps like xvdcap or recordmydesktop as you can do it straight from FFMPEG.

_________________
Come to me TUBE : Icyos Puppy Linux YouTube
Puppy Slacko 5.31 Addict - Use With Caution.
icyos@hotmail.co.uk - MSN Me

Last edited by Icyos on Tue 17 Jan 2012, 07:56; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
Amgine


Joined: 21 Sep 2011
Posts: 233
Location: Washington State

PostPosted: Thu 12 Jan 2012, 05:05    Post subject: Re: How To Use FFMPEG To Screencast from any Puppy Distro  

Icyos wrote:
Hi All

If you want to make videos in Puppy Linux to upload to youtube etc, then just open your terminal and bash the following code in..


Cool! I downloaded "Recordmydesktop" after watching one of your videos "Puppy Linux 5.28 Part 1 & Pt2" (Yesterday.) I will try this, thanks...
Back to top
View user's profile Send private message 
Amgine


Joined: 21 Sep 2011
Posts: 233
Location: Washington State

PostPosted: Thu 12 Jan 2012, 05:30    Post subject:  

I tried it, very nice. But I can not view the videos from Puppy, but I can from a different puppy build and my main OS. It does the same for "record my desktop" I am using 5.2.8 004
Back to top
View user's profile Send private message 
Icyos


Joined: 28 Jun 2011
Posts: 92
Location: UK

PostPosted: Thu 12 Jan 2012, 06:36    Post subject:  

Hi Buddy

I dont use the updates and I have no problems I am using 5.28 with no update added, and mplayer plays the original files back no problems at all.

I will add the 004 update and let you know. Thanks for your kind words re me youtube.

_________________
Come to me TUBE : Icyos Puppy Linux YouTube
Puppy Slacko 5.31 Addict - Use With Caution.
icyos@hotmail.co.uk - MSN Me
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
Icyos


Joined: 28 Jun 2011
Posts: 92
Location: UK

PostPosted: Thu 12 Jan 2012, 06:43    Post subject:  

Hi I have upgraded my 5.28 to 004 and my mplayer works just fine so please can you post some screen shots of your issue and I will try to help you resolve it.
_________________
Come to me TUBE : Icyos Puppy Linux YouTube
Puppy Slacko 5.31 Addict - Use With Caution.
icyos@hotmail.co.uk - MSN Me
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
Amgine


Joined: 21 Sep 2011
Posts: 233
Location: Washington State

PostPosted: Thu 12 Jan 2012, 19:47    Post subject:  

Thank you for the reply..

Here is a quick video.

http://flic.kr/p/bbUhca
Back to top
View user's profile Send private message 
Amgine


Joined: 21 Sep 2011
Posts: 233
Location: Washington State

PostPosted: Fri 13 Jan 2012, 16:03    Post subject:  

I have decided to re do my USB, I was hoping to know what went wrong but no big deal.

Thank you

Edit:

It works fine now.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Fri 13 Jan 2012, 18:24    Post subject:  

I'm excited !

the ffmpeg line runs good on puppy 511 which had ffmpeg 0.5.2 installed without x11grab support .

i have compiled 7.11 and 9.1 with x11grab and can see the screen capture in mplayer . gxine-059 does not want to play .avi videos , but thats it .

will have to check it on Puppy 4 series where i could not get it to work until now .

***

this is the console output of v.7.11 which apparently compiled with a larger amount of warnings than 9.1 :
Code:
./ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s 1000x900 -r 25 -i :0.0 -sameq /root/test2.avi

ffmpeg version 0.7.11, Copyright (c) 2000-2011 the FFmpeg developers
built on Jan 13 2012 23:04:34 with gcc 4.4.3
configuration: --disable-yasm --enable-sram --enable-pic --enable-zlib --enable-bzlib --enable-gpl --enable-x11grab

libavutil 50. 43. 0 / 50. 43. 0
libavcodec 52.123. 0 / 52.123. 0
libavformat 52.111. 0 / 52.111. 0
libavdevice 52. 5. 0 / 52. 5. 0
libavfilter 1. 80. 0 / 1. 80. 0
libswscale 0. 14. 1 / 0. 14. 1
libpostproc 51. 2. 0 / 51. 2. 0

[alsa @ 0x8dd2e00] Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'hw:0,0':
Duration: N/A, start: 4539.999955, bitrate: N/A
Stream #0.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s

[x11grab @ 0x8dccfc0] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1000 height: 900
[x11grab @ 0x8dccfc0] shared memory extension found
[x11grab @ 0x8dccfc0] Estimating duration from bitrate, this may be inaccurate

Input #1, x11grab, from ':0.0':
Duration: N/A, start: 1326499552.323660, bitrate: 720000 kb/s
Stream #1.0: Video: rawvideo, bgra, 1000x900, 720000 kb/s, 25 tbr, 1000k tbn, 25 tbc
Incompatible pixel format 'bgra' for codec 'mpeg4', auto-selecting format 'yuv420p'

[buffer @ 0x8dcce60] w:1000 h:900 pixfmt:bgra tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x8dd2d60] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x8dd48a0] w:1000 h:900 fmt:bgra -> w:1000 h:900 fmt:yuv420p flags:0x4

Output #0, avi, to '/root/test2.avi':
Metadata:
ISFT : Lavf52.111.0
Stream #0.0: Video: mpeg4, yuv420p, 1000x900, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream #0.1: Audio: mp2, 48000 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
Stream #1.0 -> #0.0
Stream #0.0 -> #0.1

Press [q] to stop, [?] for help
frame= 6 fps= 0 q=0.0 size= 573kB time=00:00:00.48 bitrate=9781.2kbits/s
frame= 11 fps= 10 q=0.0 size= 773kB time=00:00:01.05 bitrate=5998.5kbits/s
.
.
.

*****

Exclamation
Back to top
View user's profile Send private message Visit poster's website 
Dingo


Joined: 11 Dec 2007
Posts: 1423
Location: somewhere at the end of rainbow...

PostPosted: Fri 13 Jan 2012, 22:49    Post subject:  

I just compiled ffmpeg 0.9.1 in Puppy 3.01 but command is not working. it returns to me this error
Code:
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s 1000x900 -r 25 -i :0.0 -sameq /root/test2.avi
ffmpeg version 0.9.1, Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan 14 2012 03:39:21 with gcc 4.1.2
  configuration: --prefix=/usr --disable-yasm --enable-sram --enable-pic --enable-zlib --enable-bzlib --enable-gpl --enable-x11grab
  libavutil    51. 32. 0 / 51. 32. 0
  libavcodec   53. 42. 4 / 53. 42. 4
  libavformat  53. 24. 2 / 53. 24. 2
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 53. 0 /  2. 53. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Unknown input format: 'alsa'

_________________
replace .co.cc with .info to get access to stuff I posted in forum
dropbox 2GB free
OpenOffice for Puppy Linux
Back to top
View user's profile Send private message Visit poster's website 
Amgine


Joined: 21 Sep 2011
Posts: 233
Location: Washington State

PostPosted: Fri 13 Jan 2012, 23:22    Post subject:  

Dingo wrote:
I just compiled ffmpeg 0.9.1 in Puppy 3.01 but command is not working. it returns to me this error
Code:
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s 1000x900 -r 25 -i :0.0 -sameq /root/test2.avi
ffmpeg version 0.9.1, Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan 14 2012 03:39:21 with gcc 4.1.2
  configuration: --prefix=/usr --disable-yasm --enable-sram --enable-pic --enable-zlib --enable-bzlib --enable-gpl --enable-x11grab
  libavutil    51. 32. 0 / 51. 32. 0
  libavcodec   53. 42. 4 / 53. 42. 4
  libavformat  53. 24. 2 / 53. 24. 2
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 53. 0 /  2. 53. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Unknown input format: 'alsa'


Do you have alsa mixer installed?
Back to top
View user's profile Send private message 
pemasu


Joined: 08 Jul 2009
Posts: 5465
Location: Finland

PostPosted: Sat 14 Jan 2012, 06:02    Post subject:  

# ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s 1000x900 -r 25 -i :0.0 -sameq /root/test2.avi
ffmpeg version 0.9.1.git-5387f99 Copyright (c) 2000-2012 the FFmpeg developers
built on Jan 12 2012 00:48:53 with gcc 4.4.5

configuration: --prefix=/usr --cpu=i686 --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-pthreads --enable-small --enable-postproc --enable-libvorbis --enable-gpl --enable-shared --enable-nonfree --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-debug --enable-bzlib --enable-zlib --enable-libspeex --enable-version3 --enable-runtime-cpudetect --enable-x11grab --enable-libdc1394 --enable-libschroedinger --enable-libtheora --enable-libxvid --enable-swscale --enable-libvpx
libavutil 51. 34.100 / 51. 34.100
libavcodec 53. 54.100 / 53. 54.100
libavformat 53. 29.100 / 53. 29.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 58.100 / 2. 58.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
libpostproc 51. 2.100 / 51. 2.100
[alsa @ 0x8065b20] Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'hw:0,0':
Duration: N/A, start: 1326535071.946597, bitrate: N/A
Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[x11grab @ 0x8060020] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1000 height: 900
[x11grab @ 0x8060020] shared memory extension found
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 139 (MIT-SHM)
Minor opcode of failed request: 4 (X_ShmGetImage)
Serial number of failed request: 11
Current serial number in output stream: 11

Second try:
# ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s 1280x800 -r 25 -i :0.0 -sameq /root/test2.avi
ffmpeg version 0.9.1.git-5387f99 Copyright (c) 2000-2012 the FFmpeg developers

X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 139 (MIT-SHM)
Minor opcode of failed request: 4 (X_ShmGetImage)
Serial number of failed request: 11
Current serial number in output stream: 11

Third try:
# ffmpeg -f alsa -:ac 2 -i hw:0,0 -f x11grab -s 1280x600 -r 25 -i :0.0 -sameq /root/test2.avi
[alsa @ 0x8065b20] Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'hw:0,0':
Duration: N/A, start: 1326535124.738427, bitrate: N/A
Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[x11grab @ 0x8060020] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1280 height: 600
[x11grab @ 0x8060020] shared memory extension found
[x11grab @ 0x8060020] Estimating duration from bitrate, this may be inaccurate
Input #1, x11grab, from ':0.0':
Duration: N/A, start: 1326535124.834443, bitrate: 614400 kb/s
Stream #1:0: Video: rawvideo (BGRA / 0x41524742), bgra, 1280x600, 614400 kb/s, 25 tbr, 1000k tbn, 25 tbc
File '/root/test2.avi' already exists. Overwrite ? [y/N] y
Incompatible pixel format 'bgra' for codec 'mpeg4', auto-selecting format 'yuv420p'
[buffer @ 0x8065820] w:1280 h:600 pixfmt:bgra tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x806a640] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out'
[scale @ 0x806aba0] w:1280 h:600 fmt:bgra -> w:1280 h:600 fmt:yuv420p flags:0x4
Output #0, avi, to '/root/test2.avi':
Metadata:
ISFT : Lavf53.29.100
Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1280x600, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, 2 channels, s16, 128 kb/s
Stream mapping:
Stream #1:0 -> #0:0 (rawvideo -> mpeg4)
Stream #0:0 -> #0:1 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
[alsa @ 0x8065b20] ALSA buffer xrun.
frame= 414 fps= 25 q=0.0 Lsize= 11045kB time=00:00:16.56 bitrate=5463.8kbits/s dup=0 drop=16
video:10942kB audio:65kB global headers:0kB muxing overhead 0.343342%

So...it seems to be dependent of the selected screen resolution.
Back to top
View user's profile Send private message 
pemasu


Joined: 08 Jul 2009
Posts: 5465
Location: Finland

PostPosted: Sat 14 Jan 2012, 07:20    Post subject:  

# ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s 1366x700 -i :0.0 -aspect 16:9 -vcodec libx264 -threads auto screencast.avi

That works for me with ffmpeg-0.9.1 also. It produces good video quality due to libx264. Of course you need that lib to be installed...and that your ffmpeg has been compiled supporting it.

Output #0, avi, to 'screencast.avi':
Metadata:
ISFT : Lavf53.29.100
Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1366x700 [SAR 215:236 DAR 29369:16520], q=-1--1, 30 tbn, 30 tbc
Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, 2 channels, s16, 128 kb/s
Stream mapping:
Stream #1:0 -> #0:0 (rawvideo -> libx264)
Stream #0:0 -> #0:1 (pcm_s16le -> libmp3lame)
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Sat 14 Jan 2012, 13:20    Post subject:  

The commandline has to work , otherwise i get crazy error messages like
#Unable to find a suitable output format for '-f' Laughing

Screen resolution not being larger than actual is important as pemasu states .

The configure script autodetects headers in /usr/include .

If no alsa headers , no alsa !

I had the same with BSD kernel headers installed .
/usr/include/dev from it gave
Quote:
/usr/include/dev/bktr/ioctl_meteor.h:185: error: expected specifier-qualifier-list before 'caddr_t'

which i could not solve .
renaming /usr/include/dev to /usr/include/dev.ffmpeg.backup
AND running ./configure $MYPARAMETERS again
did not find /usr/include/dev/ and now ffmpeg finally compiled .

The sound headers should be in /usr/include/alsa .
alsactl -v
alsactl version 1.0.20

would roughly correct show which alsa lib version is installed .

By getting /usr/include/dev out of the way i got ffmpeg to compile on 4.3 and x11grab working .
Also gxine-059 shows the avi format .

*****
./configure should show these parameters at the very end :
Code:
Enabled indevs:
alsa         fbdev         v4l2
bktr         v4l         x11_grab_device
dv1394

Enabled outdevs:
alsa         sdl


I can't find a ./configure parameter to force alsa ie --enable-indev=alsa .
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Sat 14 Jan 2012, 15:31    Post subject:  

funny thing is ffmpeg recognizes the output format because of the outputfile.extension .

Code:
 ./ffmpeg -f x11grab -s 1023x767 -r 25 -i :0.0 -sameq /root/test3.flv

works for me to create a flash file .

gxine renders it 45degrees deformed .

FlashVideo File is approx. 50% larger in size than AudioVideoInterleave File .
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Sat 14 Jan 2012, 17:38    Post subject:  

Hmmm . the codeline does not work for me in a script ... ffmpeg seems not to like ' ' spaces but tabs :

This test script works for me , i have also set filetype none in geany
Code:
#!/bin/bash
#http://murga-linux.com/puppy/viewtopic.php?t=75139

#modprobe -l | grep nls |sed 's#\..*##g' |rev|cut -f 1 -d '/'|rev|while read m ; do modprobe -v $m;done

echo DBG $LANG
export LANG=C
echo DBG $LANG
var="$(xrandr | grep '*')"
echo DBG "$var"
IFS=' '
set -- $var
#export $@
export IFS=' '
echo DBG "IFS='$IFS'"
echo DBG $LANG

if [ -f ./ffmpeg -a -x ./ffmpeg ];then
FFMPEG='./ffmpeg'
elif [ -f /usr/local/bin/ffmpeg -a -x /usr/local/bin/ffmpeg ];then
FFMPEG='/usr/local/bin/ffmpeg'
else
FFMPEG=`which ffmpeg`
fi

ALSACAP=`$FFMPEG -formats 2>/dev/null|grep alsa`
X11GRABCAP=`$FFMPEG -formats 2>/dev/null|grep x11grab`

if [ ! "$ALSACAP" ];then
echo "ERROR , format 'alsa' not supported by $FFMPEG" ;exit 21
elif [ ! "$X11GRABCAP" ];then
echo "ERROR , format 'x11grab' not supported by $FFMPEG" ;exit 23
else
echo "OK , both formats supported by $FFMPEG : 'alsa' 'x11grab'"
fi

FFMPEGVERSION=`$FFMPEG -version 2>/dev/null |head -n1 |cut -f 2 -d ' '`
if [ ! "$FFMPEGVERSION" ];then
echo "ERROR , could not determine version of $FFMPEG"
exit 25;fi

c=0
if [ -e /root/test.$FFMPEGVERSION.avi ];then
c=$((c+1))
while [ -e /root/test.$FFMPEGVERSION.$c.avi ];do c=$((c+1));done
mv  /root/test.$FFMPEGVERSION.avi /root/test.$FFMPEGVERSION.$c.avi
fi
echo DBG "$@"
RESOLUTION="$1"
echo DBG $RESOLUTION

#xterm -hold -e
#vte -c
#sakura -e
echo
xterm -hold -e \
"$FFMPEG"\
   -f alsa -ac 2 -i hw:0,0\
   -f x11grab -s $RESOLUTION -r 25 -i :0.0\
   -sameq\
   /root/test.$FFMPEGVERSION.avi\
 && RV="$?" || RV="$?"
echo "$FFMPEG -f alsa -ac 2 -i hw:0,0 -f x11grab -s $RESOLUTION -r 25 -i :0.0 -sameq /root/test.$FFMPEGVERSION.avi
RETURNS : '$RV'"
exit $RV
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 2 [22 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1129s ][ Queries: 12 (0.0069s) ][ GZIP on ]