Page 1 of 2

ffmpeg record your desktop but how to stop? [Solved]

Posted: Wed 29 Dec 2010, 15:59
by Lobster
this code will run ffmpeg if installed and record your desktop actions into an mp4 video
I installed ffmpeg from Puppy 5.2 in the tweaks section of Lucid News / Quickpet
With Shadows help (programming buddy), we were able to select the screen resolution automatically 8)

Code: Select all

#!/bin/sh
var="$(xrandr | grep '*')"
IFS=" "
set -- $var
ffmpeg -f x11grab -s $1 -r 25 -i :0.0 -sameq /mnt/home/lit/test.mpg
However . . .
to stop you use ctrl + alt + backspace
and then type 'xwin'

Is there a better way to stop the video? :)

Posted: Wed 29 Dec 2010, 16:06
by puppyluvr
:D Hello,
Have you tried a "killall ffmpeg" in a terminal??

Posted: Wed 29 Dec 2010, 17:22
by Lobster
Thanks Jay :)

That will do fine have added that to LIT program and will be in next release
http://www.murga-linux.com/puppy/viewto ... 503#477503

Posted: Wed 29 Dec 2010, 21:36
by trapster
Lobster,

Please post the link to the ffmpeg you are using.
The ffmpeg's I find don't have x11grab.

Posted: Thu 30 Dec 2010, 04:05
by Lobster
Here are the i686 ffmpeg libraries that are *not* included in Lucid 5.2. It would be interesting to see if anyone noticed a difference or perhaps they even lowered the cpu usage in playing videos. Who knows?
They are optimized for i686 cpu's when they are compiled. The versions that *are* in luci-246 are compiled for i386 computers (lowest common denominator).
http://distro.ibiblio.org/pub/linux/dis ... -lucid.pet

Posted: Thu 30 Dec 2010, 07:05
by jpeps
Lobster wrote:Here are the i686 ffmpeg libraries that are *not* included in Lucid 5.2. It would be interesting to see if anyone noticed a difference or perhaps they even lowered the cpu usage in playing videos. Who knows?
They are optimized for i686 cpu's when they are compiled. The versions that *are* in luci-246 are compiled for i386 computers (lowest common denominator).
http://distro.ibiblio.org/pub/linux/dis ... -lucid.pet
Lucid already has:
/usr/lib/sse2/libspeex.so.1.5.0
/usr/lib/sse2/libspeex.so.1

Re: ffmpeg record your desktop but how to stop? [Solved]

Posted: Thu 30 Dec 2010, 09:09
by TheAsterisk!
Lobster wrote:Is there a better way to stop the video? :)
I recall reading somewhere that if you run it from a terminal then Ctrl+C would halt/end recording, but I can't find the original source to confirm it. Still, worth a try and probably neater than killing FFmpeg if it works..

Re: ffmpeg record your desktop but how to stop? [Solved]

Posted: Thu 30 Dec 2010, 15:19
by jpeps
TheAsterisk! wrote:
Lobster wrote:Is there a better way to stop the video? :)
I recall reading somewhere that if you run it from a terminal then Ctrl+C would halt/end recording, but I can't find the original source to confirm it. Still, worth a try and probably neater than killing FFmpeg if it works..
works, but app is better run/stopped by clicking on icons so terminal doesn't appear in video.

Posted: Thu 30 Dec 2010, 16:16
by puppyluvr
:D Hello,
True, an apprun script with a pidof statement like:
#!/bin/sh
if pidof ffmpeg | grep [0-9];then
killall ffmpeg
else exec ffmpeg
fi
Stop and start it with the same script....

Posted: Fri 31 Dec 2010, 12:23
by trapster
hmm...anyone?

Code: Select all

07:21:39: ~ > ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq ~/my_video.mpg
FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jul 15 2010 17:29:31 with gcc 4.2.2
  configuration: --prefix=/usr --cpu=i686 --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-libfaad --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-libtheora --enable-libxvid --enable-swscale --enable-mmx --enable-libvpx
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.73. 2 / 52.73. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Unknown input format: 'x11grab'
07:21:42: ~ >

Re: ffmpeg record your desktop but how to stop? [Solved]

Posted: Fri 31 Dec 2010, 13:14
by TheAsterisk!
jpeps wrote:works, but app is better run/stopped by clicking on icons so terminal doesn't appear in video.
I'd just as soon run the script with "xterm -e" in its *.desktop file, switch to another workspace, record my stuff, then switch back and halt/close it. You could trim away the few seconds of on-screen terminal time at the beginning and end with FFmpeg afterwards, too.

Well, to each his or her own, I suppose.

Posted: Fri 31 Dec 2010, 13:34
by stu90
Use avidemux for trimming videos as you don't have to re-encode the video file.

Posted: Fri 31 Dec 2010, 15:06
by 01micko
hmm...anyone?
It's a compile time option... --enable-X11grab

Code: Select all

Configuration options:
  --disable-static         do not build static libraries [no]
  --enable-shared          build shared libraries [no]
  --enable-gpl             allow use of GPL code, the resulting libs
                           and binaries will be under GPL [no]
  --enable-version3        upgrade (L)GPL to version 3 [no]
  --enable-nonfree         allow use of nonfree code, the resulting libs
                           and binaries will be unredistributable [no]
  --disable-doc            do not build documentation
  --disable-ffmpeg         disable ffmpeg build
  --disable-ffplay         disable ffplay build
  --disable-ffprobe        disable ffprobe build
  --disable-ffserver       disable ffserver build
  --disable-avdevice       disable libavdevice build
  --disable-avcodec        disable libavcodec build
  --disable-avcore         disable libavcore build
  --disable-avformat       disable libavformat build
  --disable-swscale        disable libswscale build
  --enable-postproc        enable GPLed postprocessing support [no]
  --disable-avfilter       disable video filter support [no]
  --disable-pthreads       disable pthreads [auto]
  --enable-w32threads      use Win32 threads [no]
  --enable-x11grab         enable X11 grabbing [no]
  --disable-network        disable network support [no]
  --disable-mpegaudio-hp   faster (but less accurate) MPEG audio decoding [no]
  --enable-gray            enable full grayscale support (slower color)
  --disable-swscale-alpha  disable alpha channel support in swscale
(list goes on)
Fortunately, ffmpeg compiles fairly easily, 0.6.1 is the latest stable.. I compiled out of svn for spup the other day, only issue was x264, I had to recompile that with --enable-shared

As for the stopping issue, I think ffmpeg has stop commands coded into it using the keyboard. A look at the man page might shed some light.

Happy New Year!

Cheers

Posted: Fri 31 Dec 2010, 15:09
by trapster
The one I have shows --enable-x11grab was configured. ?

Posted: Fri 31 Dec 2010, 15:46
by big_bass
trapster

look over this build script
to get tips or links to sources
(or if you are a slacker just use the script )

http://slackware.org.uk/people/alien/re ... SlackBuild

Fortunately, ffmpeg compiles fairly easily
:)

this can be configured many ways and far from simple
if you want a full version

Joe

Posted: Fri 31 Dec 2010, 16:00
by jpeps
trapster wrote:The one I have shows --enable-x11grab was configured. ?
Yes, but it apparently failed. Here's the ubunto config (used in lucid), which worked:

Code: Select all

FFmpeg version 0.6-4:0.6-2ubuntu4, Copyright (c) 2000-2010 the FFmpeg developers
  built on Oct  5 2010 09:49:10 with gcc 4.4.5
  configuration: --extra-version=4:0.6-2ubuntu4 --prefix=/usr --enable-avfilter --enable-avfilter-lavf  --enable-vdpau --enable-bzlib --enablelibgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads-enable-zlib--enable-libvpx --disable-stripping --enable-runtime-cpudetectenable-gpl --enable-postproc --enable-x11grab --enablelibdc1394 --enable-shared --disable-static
 libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
edit: although it complains of a "library mismatch"; ffmpeg probably needs a fresh compile.

Re: ffmpeg record your desktop but how to stop? [Solved]

Posted: Fri 31 Dec 2010, 18:41
by jpeps
TheAsterisk! wrote:
jpeps wrote:works, but app is better run/stopped by clicking on icons so terminal doesn't appear in video.
I'd just as soon run the script with "xterm -e" in its *.desktop file, switch to another workspace, record my stuff, then switch back and halt/close it. You could trim away the few seconds of on-screen terminal time at the beginning and end with FFmpeg afterwards, too.

Well, to each his or her own, I suppose.
BTW/ "q" terminates ffmpeg


I did a fresh compile for Lucid-518:
http://murga-linux.com/puppy/viewtopic. ... 365#482365

Posted: Sat 01 Jan 2011, 01:03
by 01micko
big_bass wrote: :)

this can be configured many ways and far from simple
if you want a full version

Joe
Thanks Joe, yes I should have qualified my statement :)

let me say, compiles fairly easily with these options (btw, these are similar to shinobar's)

Code: Select all

FFmpeg version SVN-r26159, Copyright (c) 2000-2010 the FFmpeg developers
  built on Dec 30 2010 09:43:50 with gcc 4.4.4
  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
______________________________________________

jpeps, yes "q" is the command to quit ffmpeg! (and it works)

Cheers

Posted: Sat 01 Jan 2011, 08:19
by stu90
I guess my laptop is lacking abit i the power department as i only get a low fps but using Lobsters script (changed output file to avi instead) and Jpegs ffmpeg .pet works here and the q key to stop.

Would be a nice feature to have built into the newer puppies. :wink:

Posted: Sat 22 Jan 2011, 17:10
by TheAsterisk!
stu90 wrote:Use avidemux for trimming videos as you don't have to re-encode the video file.
There are options you can pass FFmpeg to simply copy the stream. Works fine for both audio and video. "-acodec copy" and "-vcodec copy" are involved somewhere, but as I have a poor memory I don't remember the syntax. A while ago I made a hacky little script to compensate for that, though.

If anyone is interested, I could post it for what it's worth.