You are not logged in.
Pages: 1
Is it possible to be able to select a region with xwininfo? Like drag and select an area like in xvidcap? And then put the x and y offset into ffmpeg. I'm trying to make a ffmpeg record script that records when you select an area because I couldn't find a decent screen caster that allows selecting a region.
And one question: Is it possible to record with ffmpeg and record mic input AND system output? I can record mic input OR system output but not both (with pavucontrol). Thanks.
Last edited by Draucia (2011-10-02 13:34:02)
Offline
zenity --info --text="Resize me" &
zenity --info --text="When done resizing the resize window, press OK on THIS dialog before the resize dialog."
{ IFS=" ,x"; read u; read u x y u; read u w h; } < <(xdotool search --name Information getwindowgeometry)
echo ffmpeg blabla $w $h + $x $y
Like this with a resizable window it should be easy, right? I've never used xvidcap though. No idea about the mic problem either.
Offline
region.sh: line 3: syntax error near unexpected token `<'
region.sh: line 3: `{ IFS=" ,x"; read u; read u x y u; read u w h; } < <(xdotool search --name Information getwindowgeometry)'
Hmm something to do with xdotool I think.
Last edited by Draucia (2011-09-30 17:47:47)
Offline
Wrong shell?
Be sure to start bash scripts with
#! /bin/bash
Offline
Wrong shell?
Be sure to start bash scripts with
#! /bin/bash
Yeah it was the wrong shell. But why is this? I tried /bin/sh and it didnt work but bash does. Weird because /bin/sh is a symlink to bash.
But thanks a lot for the script. I will try it.
Offline
Check out AUR/ffcast... I scratched up xrectsel.c exactly for region selection.
The ffcast is really not good code (I know...), but the idea is simple and it's easy to hack...
This silver ladybug at line 28...
Offline
Procyon wrote:Wrong shell?
Be sure to start bash scripts with
#! /bin/bashYeah it was the wrong shell. But why is this? I tried /bin/sh and it didnt work but bash does. Weird because /bin/sh is a symlink to bash.
Not quite, it depends how bash has been invoked:
man bash:
If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well.
To know or not to know ...
... the questions remain forever.
Offline
Check out AUR/ffcast... I scratched up xrectsel.c exactly for region selection.
The ffcast is really not good code (I know...), but the idea is simple and it's easy to hack...
That's what I was looking for. It doesn't record sound, though. I tried to implement it myself but couldn't get it to work (I probably could if I read through the whole file).
Draucia wrote:Procyon wrote:Wrong shell?
Be sure to start bash scripts with
#! /bin/bashYeah it was the wrong shell. But why is this? I tried /bin/sh and it didnt work but bash does. Weird because /bin/sh is a symlink to bash.
Not quite, it depends how bash has been invoked:
man bash:
If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well.
Thanks.
Offline
lolilolicon wrote:Check out AUR/ffcast... I scratched up xrectsel.c exactly for region selection.
The ffcast is really not good code (I know...), but the idea is simple and it's easy to hack...That's what I was looking for. It doesn't record sound, though. I tried to implement it myself but couldn't get it to work (I probably could if I read through the whole file).
Try this: https://github.com/lolilolicon/ffcast/i … nt-1806411
This silver ladybug at line 28...
Offline
┌─[draucia][~/recordings]
└─╼ ffcast -s --debug
(DD) Checking display :0 with `xrectsel :0 checkdpy'
xrectsel: Valid display_name :0
(DD) VCODEC: -vcodec libx264 -vpre lossless_slow -crf 0
(DD) FORMAT: -f h264
(DD) geometry: root: 1366x768
==> Select screen area to be captured by mouse drag
-> Drag mouse with button one pressed
-> Press any key on keyboard to abort
(DD) geometry: mod 2: 68x46
(DD) geometry: in screen:68x46+1005+638
==> Capture geometry: 68x46+1005+638
(DD) ffmpeg: command line:
ffmpeg -r 15 -v 1 -s 68x46 -an -i pulse -f alsa -f x11grab -i :0+1005,638 -vcodec libx264 -vpre lossless_slow -crf 0 -f h264 -sameq "ffcast.111001044120.mkv"
==> Capture started, press [q] to finish
ffmpeg version 0.7.5, Copyright (c) 2000-2011 the FFmpeg developers
built on Sep 23 2011 13:46:45 with gcc 4.6.1 20110819 (prerelease)
configuration: --prefix=/usr --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-libx264 --enable-libvpx --enable-libtheora --enable-postproc --enable-shared --enable-x11grab --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libschroedinger --enable-libopenjpeg --enable-librtmp --enable-gpl --enable-version3 --enable-runtime-cpudetect --disable-debug
libavutil 50. 43. 0 / 50. 43. 0
libavcodec 52.122. 0 / 52.122. 0
libavformat 52.110. 0 / 52.110. 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 @ 0x9a40a0] capture with some ALSA plugins, especially dsnoop, may hang.
[alsa @ 0x9a40a0] Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'pulse':
Duration: N/A, start: 1317458481.177796, bitrate: N/A
Stream #0.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[x11grab @ 0x99ee80] device: :0+1005,638 -> display: :0 x: 1005 y: 638 width: 640 height: 480
[x11grab @ 0x99ee80] shared memory extension found
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 140 (MIT-SHM)
Minor opcode of failed request: 4 (X_ShmGetImage)
Serial number of failed request: 11
Current serial number in output stream: 11
(EE) ffmpeg: failed, try running with --debug
==> Output filename: ffcast.111001044120.mkv
Here's the part I edited:
msg "Capture started, press [q] to finish"
# -threads 0 was in the original, but segfaults with, say -vcodec flv
# Options that may help: -sameq
ffmpeg -r ${FPS} -v 1 \
-s ${LEN_X}x${LEN_Y} -f alsa -i pulse \
-f x11grab -i ${CAPDPY}+${POS_X},${POS_Y} \
${VCODEC} ${FORMAT} ${CASTSPAN} -sameq \
"${OUTPUT}" 2>"${DEBUG}" || \
err "ffmpeg: failed, try running with --debug"
msg "Output filename: %s" "${OUTPUT}"
Offline
(DD) ffmpeg: command line: ffmpeg -r 15 -v 1 -s 68x46 -an -i pulse -f alsa -f x11grab -i :0+1005,638 -vcodec libx264 -vpre lossless_slow -crf 0 -f h264 -sameq "ffcast.111001044120.mkv"
Note that option order matters for ffmpeg. Also the -an option should be removed (it disables audio recording).
Does this work for you?
ffmpeg -s 68x46 -f x11grab -i :0+1005,638 -f alsa -i pulse "ffcast.mkv"
If it does, just adjust the ffcast code accordingly.
(note to self: I really should scratch all the default parameters passed to ffmepg, and stuff whatever the user passes to it...)
This silver ladybug at line 28...
Offline
Ok so I got here is my let_me_capture:
let_me_capture () {
[ "${PRINTCMDONLY}" ] && {
msg "ffmpeg: command line:\nffmpeg -r %s -v 1 -s %sx%s -f alsa -i pulse -f x11grab -i %s+%s,%s %s %s %s -sameq \"%s\"" \
# msg "ffmpeg: command line:\nffmpeg -r %s -v 1 -s %sx%s -an -f alsa -i pulse -f x11grab -i %s+%s,%s %s %s %s -sameq \"%s\"" \
${FPS} ${LEN_X} ${LEN_Y} ${CAPDPY} ${POS_X} ${POS_Y} \
"${VCODEC}" "${FORMAT}" "${CASTSPAN}" "${OUTPUT}"
exit 0; }
#dbg "ffmpeg: command line:\nffmpeg -r %s -v 1 -s %sx%s -an -f x11grab -i %s+%s,%s %s %s %s -sameq \"%s\"" \
dbg "ffmpeg: command line:\nffmpeg -r %s -v 1 -s %sx%s -i pulse -f alsa -f x11grab -i %s+%s,%s %s %s %s -sameq \"%s\"" \
${FPS} ${LEN_X} ${LEN_Y} ${CAPDPY} ${POS_X} ${POS_Y} \
"${VCODEC}" "${FORMAT}" "${CASTSPAN}" "${OUTPUT}"
msg "Capture started, press [q] to finish"
# -threads 0 was in the original, but segfaults with, say -vcodec flv
# Options that may help: -sameq
ffmpeg -r ${FPS} -v 1 \
-s ${LEN_X}x${LEN_Y} -f alsa -i pulse \
-f x11grab -i ${CAPDPY}+${POS_X},${POS_Y} \
${VCODEC} ${FORMAT} ${CASTSPAN} -sameq \
"${OUTPUT}" 2>"${DEBUG}" || \
err "ffmpeg: failed, try running with --debug"
msg "Output filename: %s" "${OUTPUT}"
}
But it doesn't record sound. I've tried recording with
ffmpeg -s 68x46 -f x11grab -i :0+1005,638 -f alsa -i pulse "ffcast.mkv"
and it records sound, but ffcast doesn't.
Last edited by Draucia (2011-10-01 13:56:03)
Offline
As I said, option order is significant for ffmpeg. See ffmpeg man page.
You could have tried harder... but this should work,
ffmpeg -v 1 -f alsa -i pulse \
-r ${FPS} -s ${LEN_X}x${LEN_Y} \
-f x11grab -i ${CAPDPY}+${POS_X},${POS_Y} \
${VCODEC} ${FORMAT} ${CASTSPAN} -sameq \
"${OUTPUT}" 2>"${DEBUG}"
This silver ladybug at line 28...
Offline
As I said, option order is significant for ffmpeg. See ffmpeg man page.
You could have tried harder... but this should work,
ffmpeg -v 1 -f alsa -i pulse \ -r ${FPS} -s ${LEN_X}x${LEN_Y} \ -f x11grab -i ${CAPDPY}+${POS_X},${POS_Y} \ ${VCODEC} ${FORMAT} ${CASTSPAN} -sameq \ "${OUTPUT}" 2>"${DEBUG}"
Ok I put it in order like:
ffmpeg -v 1 -f alsa -i pulse \
-r ${FPS} -s ${LEN_X}x${LEN_Y} \
-f x11grab -i ${CAPDPY}+${POS_X},${POS_Y} \
${VCODEC} ${FORMAT} ${CASTSPAN} -sameq \
"${OUTPUT}" 2>"${DEBUG}" || \
err "ffmpeg: failed, try running with --debug"
msg "Output filename: %s" "${OUTPUT}"
}
but it sound still doesn't work. Another thing is that it doesn't play in vlc, only mplayer. A file recorded by something like:
ffmpeg -s 68x46 -f x11grab -i :0+1005,638 -f alsa -i pulse "ffcast.mkv"
does play in vlc, though. Is it possible to use xrecsel and output the x,y and offsets? That's like the only part I need. It would be great if I could use xrectsel and just use my own ffmpeg command.
Offline
Is it possible to use xrecsel and output the x,y and offsets? That's like the only part I need. It would be great if I could use xrectsel and just use my own ffmpeg command.
Sure you can, e.g.
#!/bin/bash
IFS=x+ read w h x y < <(xrectsel)
ffmpeg -f x11grab -s ${w}x$h -i ${DISPLAY}+$x,$y "$@"
This silver ladybug at line 28...
Offline
Draucia wrote:Is it possible to use xrecsel and output the x,y and offsets? That's like the only part I need. It would be great if I could use xrectsel and just use my own ffmpeg command.
Sure you can, e.g.
#!/bin/bash IFS=x+ read w h x y < <(xrectsel) ffmpeg -f x11grab -s ${w}x$h -i ${DISPLAY}+$x,$y "$@"
What! It was that easy? Thank's a lot dude. Now I can record my computer sound output and my mic. I'm going to mark this thread as solved, thanks.
I have a question about xrectsel though. What package is it a part of? Is it installed by default?
Offline
I have a question about xrectsel though. What package is it a part of? Is it installed by default?
It's a part of the ffcast package... nowhere else to be found
A simple `make xrectsel` in the source directory will get it compiled, so go ahead and make yourself a PKGBUILD.. if you don't want anything else from the ffcast package.
This silver ladybug at line 28...
Offline
Hi Draucia, you will like FFcast 1.0. I should thank you for reminding me of fixing it.
Cheers
This silver ladybug at line 28...
Offline
Pages: 1