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

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

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

#1 Post 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? :)
Last edited by Lobster on Wed 29 Dec 2010, 17:23, edited 2 times in total.
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
puppyluvr
Posts: 3470
Joined: Sun 06 Jan 2008, 23:14
Location: Chickasha Oklahoma
Contact:

#2 Post by puppyluvr »

:D Hello,
Have you tried a "killall ffmpeg" in a terminal??
Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!

Puppy since 2.15CE...

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

#3 Post 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
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#4 Post by trapster »

Lobster,

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

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

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

#5 Post 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
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

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

User avatar
TheAsterisk!
Posts: 406
Joined: Tue 10 Feb 2009, 08:52

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

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

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

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

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

User avatar
puppyluvr
Posts: 3470
Joined: Sun 06 Jan 2008, 23:14
Location: Chickasha Oklahoma
Contact:

#9 Post 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....
Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!

Puppy since 2.15CE...

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#10 Post 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: ~ >
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

User avatar
TheAsterisk!
Posts: 406
Joined: Tue 10 Feb 2009, 08:52

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

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

stu90

#12 Post by stu90 »

Use avidemux for trimming videos as you don't have to re-encode the video file.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#13 Post 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
Puppy Linux Blog - contact me for access

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#14 Post by trapster »

The one I have shows --enable-x11grab was configured. ?
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

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

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

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

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

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

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

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#18 Post 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
Puppy Linux Blog - contact me for access

stu90

#19 Post 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:

User avatar
TheAsterisk!
Posts: 406
Joined: Tue 10 Feb 2009, 08:52

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

Post Reply