Ubuntu Türkiye

Yazılım => Genel => Konuyu başlatan: Mint_7 - 20 Ağustos 2009 - 21:34:01

Başlık: Masaüstü Kaydedici
Gönderen: Mint_7 - 20 Ağustos 2009 - 21:34:01
Merhaba arkadaşlar. Ben linux mint 7 kullanıyorum. Bana masaüstü kaydetmek için bir program gerekiyor. Bunu araştırdım ama karşıma "istanbul" gibi programlar çıktı. Onları denedim. Görüntü çok bozuk çıkıyor. Metacity 'e geçtiğim halde düzgün bir görüntü kayıtı alamıyorum. Önerdiğiniz veya kullandığınız programları söyler misiniz?
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: rutku - 20 Ağustos 2009 - 21:39:14
RecordMyDesktop var.
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: Mint_7 - 20 Ağustos 2009 - 22:12:06
Evet onu da denedim. Sistemde 1 gb ram 2.18 cpu olduğu halde kayıt alırken takılmalar oluyor. Sistemi aşırı yoruyor ve saniyede 50 ekrana dahi getirsem Windows'taki programlar kadar kaliteli bir görüntü alamıyorum.  :(
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: maydin95 - 23 Ağustos 2009 - 19:31:16
xvidcap i dene
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: erginemr - 23 Ağustos 2009 - 20:50:47
Bu konuda bir de byzanz var:
http://forum.ubuntu-tr.net/index.php?topic=9930.0
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: agritux - 23 Ağustos 2009 - 20:52:14
En memnun kaldığım program gtk-recordmydesktop
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: ns - 23 Ağustos 2009 - 21:01:46
http://forum.ubuntu-tr.net/index.php?topic=10806.msg134588#msg134588

bu programdan da memnun kalınmış.
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: serenler - 08 Kasım 2011 - 17:00:49
recordmydesktop u yazılım yükleyiciden kurdum ama listede bulamadım kurulu diyor uçbirime komutu girince de çalıştırmıyor şu çıktıyı  veriyor
anlamadım :) yardımcı olur musunuz?

yasinoz@yasinoz-pc ~ $ recordmydesktop
Initial recording window is set to:
X:0   Y:0    Width:1366    Height:768
Adjusted recording window is set to:
X:6   Y:0    Width:1354    Height:768
Your window manager appears to be Compiz


Detected compositing window manager.
Reverting to full screen capture at every frame.
To disable this check run with --no-wm-check
(though that is not advised, since it will probably produce faulty results).

Initializing...
Buffer size adjusted to 4096 from 4096 frames.
Opened PCM device default
Recording on device default is set to:
1 channels at 22050Hz
Capturing!
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: experotux - 08 Kasım 2011 - 17:06:54
Neden uçbirimden çalıştırıyorsunuz ki menüden çalıştırsanız ya :)
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: serenler - 08 Kasım 2011 - 17:07:53
Alıntı yapılan: serenler - 08 Kasım 2011 - 17:00:49
ama listede bulamadım



derken menüde bulamadım demek istemiştim
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: experotux - 08 Kasım 2011 - 17:23:59
O halde düzgün kurulmamış olabilir
Yeniden kurun bence
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: alquirel - 08 Kasım 2011 - 17:35:32
Benim bu çıktılardan anladığım şu:

Kurduğunuz uygulama arayüzü olmayan bir uygulama, sadece komut satırından çalışıyor.
Menüde bulamayışınızın sebebi bu olabilir.
Zaten çıktıda da kayda başladığını belirtmiş "Capturing" diyerek.

Eğer kullanımı ile ilgili bir belge varsa biraz inceleyin derim.

Alıntı yapılan: experotux - 08 Kasım 2011 - 17:06:54
Neden uçbirimden çalıştırıyorsunuz ki menüden çalıştırsanız ya :)
Alıntı yapılan: experotux - 08 Kasım 2011 - 17:23:59
O halde düzgün kurulmamış olabilir
Yeniden kurun bence

Uçbirimden çalıştırmak, uygulamanın düzgün kurulup kurulmadığını anlamanın en garanti yoludur.
Ayrıca her kurulan şey, menüye yerleşecek diye bir kaide yok. Dolayısıyla menüde olmaması düzgün kurulmamış olmasını da gerektirmez.

@serenler, eğer Gnome Shell kullanıyor olsaydınız Ctrl Alt Shift R tuşlarıyla ekranı kaydedebilirdiniz.
Mesela o kaydedici de arayüz veya menüye sahip değil. Basıyorsunuz başlıyor, tekrar basıyorsunuz bitiyor.
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: experotux - 08 Kasım 2011 - 17:47:15
Arkadaş o programı gtk-recormydesktop olarak indireydi hem menüde logosu olurdu hem de grafik arayüzü olurdu.
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: alquirel - 08 Kasım 2011 - 18:09:12
Alıntı yapılan: experotux - 08 Kasım 2011 - 17:47:15
Arkadaş o programı gtk-recormydesktop olarak indireydi hem menüde logosu olurdu hemde grafik arayüzü olurdu

Bu durumda @serenler'in kurulumu hatalı değil, sadece arayüz de istiyorsa ek bir paket kurması lazım.
Yani bu tavsiyeyi "düzgün kurulmamış olabilir, yeniden kurun bence" tavsiyesinden önce söylemek gerekirdi.
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: experotux - 08 Kasım 2011 - 18:50:23
Söylememiş varsayıyorum  o halde
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: serenler - 08 Kasım 2011 - 21:12:40
pekala arkadaşlar gtk-recormydesktop kuruyorum öyleyse
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: maydin95 - 09 Kasım 2011 - 11:27:42
Bu arada GNOME 3'ün kendisinde var olan bir kaydedici varmış. Ondaki performans nasıl acaba? Deneyen var mı? Dergide arkadaş söylemişti.
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: alquirel - 09 Kasım 2011 - 16:23:23
Alıntı yapılan: maydin95 - 09 Kasım 2011 - 11:27:42
Bu arada GNOME 3'ün kendisinde var olan bir kaydedici varmış. Ondaki performans nasıl acaba? Deneyen var mı? Dergide arkadaş söylemişti.

Dergide söyleyen kişi olarak cevap veriyorum.
Malesef benim bilgisayarın özellikleri nisbeten düşük olduğu için videolar takılarak kaydediliyordu, ama bu tahminimce hangi kaydediciyi kullanırsam kullanayım başıma gelecek şey.
Görüntü kalitesi ise gayet tatmin edici. Videoları webm biçiminde kaydediyor.

Takılma konusunda sağlıklı bir yorum yapamayacağım, daha yüksek özellikte bilgisayarı olan arkadaşlardan da dinlemek gerek.
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: maydin95 - 09 Kasım 2011 - 18:58:15
Ya Windowsta gayet iyi çalışan masaüstü kaydetme programları Linux için çok kötü. Eski bilgisayarımda CamStudio ile XP'de mükemmel sonuçlar alırken RMD çok kötü sonuçlar veriyordu. XVidCap daha iyiydi nisbeten. Ancak özellik olarak CamStudio yine daha iyiydi. Hoparlör sesini kaydetme vs. vardı. Bunlar Gnome 3 kaydecisinde var mı peki? Yoksa sadece Masaüstü kaydedici mi?
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: alquirel - 09 Kasım 2011 - 19:25:36
Ses kaydedip kaydetmediğini bilmiyorum, benim kaydettiklerimde ses olmuyor, ama bu durum benim mikrofonumun da olmamasına bağlı olabilir :D
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: maydin95 - 11 Kasım 2011 - 19:40:16
O kaydedicinin hiçbir ayarı yok mu ya? Kaydete basıyorsun kaydediyor, sadece bu mu? Ses kaydetmesini buna bağlı olarak sormuştum :)
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: eribol - 11 Kasım 2011 - 20:00:49
Bu tür programlar eğer mikrofon ayarları yapılmışsa otomatik kaydeder sesi. Ancak benim önerdiğim program başka.#!/usr/bin/env python

""" A simple screen-capture utility.  Utilizes ffmpeg with h264 support.
By default it captures the entire desktop.
"""

################################ LICENSE BLOCK ################################
# Copyright (c) 2011 Nathan Vegdahl
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
###############################################################################

# Easy-to-change defaults for users
DEFAULT_FPS = 15
DEFAULT_FILE_EXTENSION = ".mkv"
ACCEPTABLE_FILE_EXTENSIONS = [".avi", ".mp4", ".mov", ".mkv", ".ogv"]
DEFAULT_CAPTURE_AUDIO_DEVICE = "pulse"
DEFAULT_CAPTURE_DISPLAY_DEVICE = ":0.0"
DEFAULT_AUDIO_CODEC = "vorbis"
DEFAULT_VIDEO_CODEC = "h264_fast"

import os
import sys
import os.path
import glob
import time
import random
import tempfile
import optparse
import subprocess
import re


PYTHON_3 = (sys.version_info[0] == 3)


# Optional packages
try:
    import Tkinter
    have_tk = True
except ImportError:
    have_tk = False

try:
    import multiprocessing
    have_multiproc = True
except ImportError:
    have_multiproc = False


# Video codec lines
vcodecs = {}
vcodecs["h264"] = ["-vcodec", "libx264", "-vpre", "lossless_medium"]
vcodecs["h264_fast"] = ["-vcodec", "libx264", "-vpre", "lossless_ultrafast"]
vcodecs["mpeg4"] = ["-vcodec", "mpeg4", "-qmax", "1", "-qmin", "1"]
#vcodecs["xvid"] = ["-vcodec", "libxvid", "-b", "40000kb"]
vcodecs["huffyuv"] = ["-vcodec", "huffyuv"]
vcodecs["vp8"] = ["-vcodec", "libvpx", "-qmax", "2", "-qmin", "1"]
vcodecs["theora"] = ["-vcodec", "libtheora", "-b", "40000kb"]
#vcodecs["dirac"] = ["-vcodec", "libschroedinger", "-b", "40000kb"]

# Audio codec lines
acodecs = {}
acodecs["pcm"] = ["-acodec", "pcm_s16le"]
#acodecs["flac"] = ["-acodec", "flac"]
acodecs["vorbis"] = ["-acodec", "libvorbis", "-ab", "320k"]
acodecs["mp3"] = ["-acodec", "libmp3lame", "-ab", "320k"]
acodecs["aac"] = ["-acodec", "libfaac", "-ab", "320k"]


def capture_line(fps, x, y, height, width, display_device, audio_device, video_codec, audio_codec, output_path):
    """ Returns the command line to capture video+audio, in a list form
        compatible with Popen.
    """
    threads = 2
    if have_multiproc:
        # Detect the number of threads we have available
        threads = multiprocessing.cpu_count()
    line = ["ffmpeg",
            "-f", "alsa",
            "-ac", "2",
            "-i", str(audio_device),
            "-f", "x11grab",
            "-r", str(fps),
            "-s", "%dx%d" % (int(height), int(width)),
            "-i", display_device + "+" + str(x) + "," + str(y)]
    line += acodecs[audio_codec]
    line += vcodecs[video_codec]
    line += ["-threads", str(threads), str(output_path)]
    return line


def video_capture_line(fps, x, y, height, width, display_device, video_codec, output_path):
    """ Returns the command line to capture video (no audio), in a list form
        compatible with Popen.
    """
    threads = 2
    if have_multiproc:
        # Detect the number of threads we have available
        threads = multiprocessing.cpu_count()

    line = ["ffmpeg",
            "-f", "x11grab",
            "-r", str(fps),
            "-s", "%dx%d" % (int(height), int(width)),
            "-i", display_device + "+" + str(x) + "," + str(y)]
    line += vcodecs[video_codec]
    line += ["-threads", str(threads), str(output_path)]
    return line


def audio_capture_line(audio_device, audio_codec, output_path):
    """ Returns the command line to capture audio (no video), in a list form
        compatible with Popen.
    """
    line = ["ffmpeg",
            "-f", "alsa",
            "-ac", "2",
            "-i", str(audio_device)]
    line += acodecs[audio_codec]
    line += [str(output_path)]
    return line


def get_desktop_resolution():
    """ Returns the resolution of the desktop as a tuple.
    """
    if have_tk:
        # Use tk to get the desktop resolution if we have it
        root = Tkinter.Tk()
        width = root.winfo_screenwidth()
        height = root.winfo_screenheight()
        root.destroy()
        return (width, height)
    else:
        # Otherwise call xdpyinfo and parse its output
        try:
            proc = subprocess.Popen("xdpyinfo", stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        except OSError:
            return None
        out, err = proc.communicate()
        if PYTHON_3:
            lines = str(out).split("\\n")
        else:
            lines = out.split("\n")
        for line in lines:
            if "dimensions" in line:
                line = re.sub(".*dimensions:[ ]*", "", line)
                line = re.sub("[ ]*pixels.*", "", line)
                wh = line.strip().split("x")
                return (int(wh[0]), int(wh[1]))


def get_window_position_and_size():
    """ Prompts the user to click on a window, and returns the window's
        position and size.
    """
    try:
        proc = subprocess.Popen("xwininfo", stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    except OSError:
        return None
    out, err = proc.communicate()
    if PYTHON_3:
        lines = str(out).split("\\n")
    else:
        lines = out.split("\n")
    x = 0
    y = 0
    w = 0
    h = 0
    xt = False
    yt = False
    wt = False
    ht = False
    for line in lines:
        if "Absolute upper-left X:" in line:
            x = int(re.sub("[^0-9]", "", line))
            xt = True
        elif "Absolute upper-left Y:" in line:
            y = int(re.sub("[^0-9]", "", line))
            yt = True
        elif "Width:" in line:
            w = int(re.sub("[^0-9]", "", line))
            wt = True
        elif "Height:" in line:
            h = int(re.sub("[^0-9]", "", line))
            ht = True
    if xt and yt and wt and ht:
        return (x, y, w, h)
    else:
        return None


def get_default_output_path():
    """ Creates a default output file path.
        Pattern: out_####.ext
    """
    filenames = glob.glob("out_????" + DEFAULT_FILE_EXTENSION)
    for i in range(1, 9999):
        name = "out_" + str(i).rjust(4,'0') + DEFAULT_FILE_EXTENSION
        tally = 0
        for f in filenames:
            if f == name:
                tally += 1
        if tally == 0:
            return name
    return "out_9999" + DEFAULT_FILE_EXTENSION


def print_codecs():
    """ Prints a list of the available audio/video codecs.
    """
    a = []
    v = []
    for i in acodecs:
        a += [i]
    for i in vcodecs:
        v += [i]
    a.sort()
    v.sort()

    print("Audio codecs:")
    for i in a:
        print("  " + str(i))

    print("Video codecs:")
    for i in vcodecs:
        print("  " + str(i))

if __name__ == "__main__":
    # Set up default file path
    out_path = get_default_output_path()

    # Parse command line arguments
    parser = optparse.OptionParser(usage="%prog [options] [output_file" + DEFAULT_FILE_EXTENSION + "]")
    parser.add_option("-w", "--capture-window", action="store_true", dest="capture_window",
                      default=False,
                      help="prompt user to click on a window to capture")
    parser.add_option("-n", "--no-audio", action="store_true", dest="no_audio",
                      default=False,
                      help="don't capture audio")
    parser.add_option("-r", "--fps", dest="fps",
                      type="int", default=DEFAULT_FPS,
                      help="frame rate to capture video at. Default: " + str(DEFAULT_FPS))
    parser.add_option("-p", "--position", dest="xy", metavar="XxY",
                      type="string", default=None,
                      help="upper left corner of the capture area (in pixels from the upper left of the screen). Default: 0x0")
    parser.add_option("-s", "--size", dest="size",
                      type="string", default=None, metavar="WIDTHxHEIGHT",
                      help="resolution of the capture area (in pixels). Default: entire desktop")
    parser.add_option("--crop-top", dest="crop_top",
                      type="int", default=0,
                      help="number of pixels to crop off the top of the capture area")
    parser.add_option("--crop-bottom", dest="crop_bottom",
                      type="int", default=0,
                      help="number of pixels to crop off the bottom of the capture area")
    parser.add_option("--crop-left", dest="crop_left",
                      type="int", default=0,
                      help="number of pixels to crop off the left of the capture area")
    parser.add_option("--crop-right", dest="crop_right",
                      type="int", default=0,
                      help="number of pixels to crop off the right of the capture area")
    parser.add_option("-a", "--audio-device", dest="audio_device",
                      default=DEFAULT_CAPTURE_AUDIO_DEVICE,
                      help="the audio device to capture from (eg. hw:0).  Default: " + DEFAULT_CAPTURE_AUDIO_DEVICE)
    parser.add_option("-d", "--display-device", dest="display_device",
                      default=DEFAULT_CAPTURE_DISPLAY_DEVICE,
                      help="the display device to capture from (eg. :0.0).  Default: " + DEFAULT_CAPTURE_DISPLAY_DEVICE)
    parser.add_option("--acodec", dest="acodec",
                      default=DEFAULT_AUDIO_CODEC,
                      help="the audio codec to encode with.  Default: " + DEFAULT_AUDIO_CODEC)
    parser.add_option("--vcodec", dest="vcodec",
                      default=DEFAULT_VIDEO_CODEC,
                      help="the video codec to encode with.  Default: " + DEFAULT_VIDEO_CODEC)
    parser.add_option("--codecs", action="store_true", dest="list_codecs",
                      default=False,
                      help="display the available audio and video codecs")

    opts, args = parser.parse_args()

    # Print list of codecs, if requested
    if opts.list_codecs:
        print_codecs()
        exit(0)

    # Output file path
    if len(args) >= 1:
        out_path = args[0]
        if out_path[-4:] not in ACCEPTABLE_FILE_EXTENSIONS:
            out_path += DEFAULT_FILE_EXTENSION

    # Get desktop resolution
    try:
        dres = get_desktop_resolution()
    except:
        print("Error: unable to determine desktop resolution.")
        raise

    # Capture values
    fps = opts.fps
    if opts.capture_window:
        print("Please click on a window to capture.")
        x, y, width, height = get_window_position_and_size()
    else:
        if opts.xy:
            if re.match("^[0-9]*x[0-9]*$", opts.xy.strip()):
                xy = opts.xy.strip().split("x")
                x = int(xy[0])
                y = int(xy[1])
            else:
                raise parser.error("position option must be of form XxY (e.g. 50x64)")
        else:
            x = 0
            y = 0

        if opts.size:
            if re.match("^[0-9]*x[0-9]*$", opts.size.strip()):
                size = opts.size.strip().split("x")
                width = int(size[0])
                height = int(size[1])
            else:
                raise parser.error("size option must be of form HxW (e.g. 1280x720)")
        else:
            width = dres[0]
            height = dres[1]

    # Calculate cropping
    width -= opts.crop_left + opts.crop_right
    height -= opts.crop_top + opts.crop_bottom
    x += opts.crop_left
    y += opts.crop_top

    # Make sure the capture resolution conforms to the restrictions
    # of the video codec.  Crop to conform, if necessary.
    mults = {"h264": 2, "h264_fast": 2, "mpeg4": 2, "dirac": 2, "xvid": 2, "theora": 8, "huffyuv": 2, "vp8": 1}
    width -= width % mults[opts.vcodec]
    height -= height % mults[opts.vcodec]

    # Verify that capture area is on screen
    if (x + width) > dres[0] or (y + height) > dres[1]:
        parser.error("specified capture area is off screen.")

    # Capture!
    if not opts.no_audio:
        proc = subprocess.Popen(capture_line(fps, x, y, width, height, opts.display_device, opts.audio_device, opts.vcodec, opts.acodec, out_path)).wait()
    else:
        proc = subprocess.Popen(video_capture_line(fps, x, y, width, height, opts.display_device, opts.vcodec, out_path)).wait()

    print("Done!")

Bu kodları ev dizininde herhangi bir dizin içerisine(misal recordscreen dizini olsun) recordscreen.py adıyla kaydedin. Terminalden cd recordscreen./recordscreen.pykomutlarını kullanarak çalıştırın. AYnı dizin içerisine mkv uzantılı olarak kaydedecektir. Açıkçası en kaliteli kaydedici budur diyebilirim.


Mesaj tekrarı yüzünden mesajınız birleştirildi. Bu mesajın gönderim tarihi : 11 Kasım 2011 - 20:06:34

Alıntı YapTakılma konusunda sağlıklı bir yorum yapamayacağım, daha yüksek özellikte bilgisayarı olan arkadaşlardan da dinlemek gerek.
i7 işlemcide takılma olmuyor. Bir iki defa denemiştim o sırada ses kaydetmiyor diye aklımda kalmıştı ama meğer mikrofon rahmetli olmuş.
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: gufabe - 11 Kasım 2011 - 20:13:07
Bu arada, başlığı açan kullanıcı ekran kartı sorunu yaşamış olabilir diye düşünüyorum. ''İstanbul'' adlı yazılım için bir hata gözlemlemedim ben.
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: maydin95 - 12 Kasım 2011 - 20:24:06
Alıntı yapılan: eribol - 11 Kasım 2011 - 20:00:49
Bu tür programlar eğer mikrofon ayarları yapılmışsa otomatik kaydeder sesi. Ancak benim önerdiğim program başka.#!/usr/bin/env python

""" A simple screen-capture utility.  Utilizes ffmpeg with h264 support.
By default it captures the entire desktop.
"""

################################ LICENSE BLOCK ################################
# Copyright (c) 2011 Nathan Vegdahl
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
###############################################################################

# Easy-to-change defaults for users
DEFAULT_FPS = 15
DEFAULT_FILE_EXTENSION = ".mkv"
ACCEPTABLE_FILE_EXTENSIONS = [".avi", ".mp4", ".mov", ".mkv", ".ogv"]
DEFAULT_CAPTURE_AUDIO_DEVICE = "pulse"
DEFAULT_CAPTURE_DISPLAY_DEVICE = ":0.0"
DEFAULT_AUDIO_CODEC = "vorbis"
DEFAULT_VIDEO_CODEC = "h264_fast"

import os
import sys
import os.path
import glob
import time
import random
import tempfile
import optparse
import subprocess
import re


PYTHON_3 = (sys.version_info[0] == 3)


# Optional packages
try:
    import Tkinter
    have_tk = True
except ImportError:
    have_tk = False

try:
    import multiprocessing
    have_multiproc = True
except ImportError:
    have_multiproc = False


# Video codec lines
vcodecs = {}
vcodecs["h264"] = ["-vcodec", "libx264", "-vpre", "lossless_medium"]
vcodecs["h264_fast"] = ["-vcodec", "libx264", "-vpre", "lossless_ultrafast"]
vcodecs["mpeg4"] = ["-vcodec", "mpeg4", "-qmax", "1", "-qmin", "1"]
#vcodecs["xvid"] = ["-vcodec", "libxvid", "-b", "40000kb"]
vcodecs["huffyuv"] = ["-vcodec", "huffyuv"]
vcodecs["vp8"] = ["-vcodec", "libvpx", "-qmax", "2", "-qmin", "1"]
vcodecs["theora"] = ["-vcodec", "libtheora", "-b", "40000kb"]
#vcodecs["dirac"] = ["-vcodec", "libschroedinger", "-b", "40000kb"]

# Audio codec lines
acodecs = {}
acodecs["pcm"] = ["-acodec", "pcm_s16le"]
#acodecs["flac"] = ["-acodec", "flac"]
acodecs["vorbis"] = ["-acodec", "libvorbis", "-ab", "320k"]
acodecs["mp3"] = ["-acodec", "libmp3lame", "-ab", "320k"]
acodecs["aac"] = ["-acodec", "libfaac", "-ab", "320k"]


def capture_line(fps, x, y, height, width, display_device, audio_device, video_codec, audio_codec, output_path):
    """ Returns the command line to capture video+audio, in a list form
        compatible with Popen.
    """
    threads = 2
    if have_multiproc:
        # Detect the number of threads we have available
        threads = multiprocessing.cpu_count()
    line = ["ffmpeg",
            "-f", "alsa",
            "-ac", "2",
            "-i", str(audio_device),
            "-f", "x11grab",
            "-r", str(fps),
            "-s", "%dx%d" % (int(height), int(width)),
            "-i", display_device + "+" + str(x) + "," + str(y)]
    line += acodecs[audio_codec]
    line += vcodecs[video_codec]
    line += ["-threads", str(threads), str(output_path)]
    return line


def video_capture_line(fps, x, y, height, width, display_device, video_codec, output_path):
    """ Returns the command line to capture video (no audio), in a list form
        compatible with Popen.
    """
    threads = 2
    if have_multiproc:
        # Detect the number of threads we have available
        threads = multiprocessing.cpu_count()

    line = ["ffmpeg",
            "-f", "x11grab",
            "-r", str(fps),
            "-s", "%dx%d" % (int(height), int(width)),
            "-i", display_device + "+" + str(x) + "," + str(y)]
    line += vcodecs[video_codec]
    line += ["-threads", str(threads), str(output_path)]
    return line


def audio_capture_line(audio_device, audio_codec, output_path):
    """ Returns the command line to capture audio (no video), in a list form
        compatible with Popen.
    """
    line = ["ffmpeg",
            "-f", "alsa",
            "-ac", "2",
            "-i", str(audio_device)]
    line += acodecs[audio_codec]
    line += [str(output_path)]
    return line


def get_desktop_resolution():
    """ Returns the resolution of the desktop as a tuple.
    """
    if have_tk:
        # Use tk to get the desktop resolution if we have it
        root = Tkinter.Tk()
        width = root.winfo_screenwidth()
        height = root.winfo_screenheight()
        root.destroy()
        return (width, height)
    else:
        # Otherwise call xdpyinfo and parse its output
        try:
            proc = subprocess.Popen("xdpyinfo", stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        except OSError:
            return None
        out, err = proc.communicate()
        if PYTHON_3:
            lines = str(out).split("\\n")
        else:
            lines = out.split("\n")
        for line in lines:
            if "dimensions" in line:
                line = re.sub(".*dimensions:[ ]*", "", line)
                line = re.sub("[ ]*pixels.*", "", line)
                wh = line.strip().split("x")
                return (int(wh[0]), int(wh[1]))


def get_window_position_and_size():
    """ Prompts the user to click on a window, and returns the window's
        position and size.
    """
    try:
        proc = subprocess.Popen("xwininfo", stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    except OSError:
        return None
    out, err = proc.communicate()
    if PYTHON_3:
        lines = str(out).split("\\n")
    else:
        lines = out.split("\n")
    x = 0
    y = 0
    w = 0
    h = 0
    xt = False
    yt = False
    wt = False
    ht = False
    for line in lines:
        if "Absolute upper-left X:" in line:
            x = int(re.sub("[^0-9]", "", line))
            xt = True
        elif "Absolute upper-left Y:" in line:
            y = int(re.sub("[^0-9]", "", line))
            yt = True
        elif "Width:" in line:
            w = int(re.sub("[^0-9]", "", line))
            wt = True
        elif "Height:" in line:
            h = int(re.sub("[^0-9]", "", line))
            ht = True
    if xt and yt and wt and ht:
        return (x, y, w, h)
    else:
        return None


def get_default_output_path():
    """ Creates a default output file path.
        Pattern: out_####.ext
    """
    filenames = glob.glob("out_????" + DEFAULT_FILE_EXTENSION)
    for i in range(1, 9999):
        name = "out_" + str(i).rjust(4,'0') + DEFAULT_FILE_EXTENSION
        tally = 0
        for f in filenames:
            if f == name:
                tally += 1
        if tally == 0:
            return name
    return "out_9999" + DEFAULT_FILE_EXTENSION


def print_codecs():
    """ Prints a list of the available audio/video codecs.
    """
    a = []
    v = []
    for i in acodecs:
        a += [i]
    for i in vcodecs:
        v += [i]
    a.sort()
    v.sort()

    print("Audio codecs:")
    for i in a:
        print("  " + str(i))

    print("Video codecs:")
    for i in vcodecs:
        print("  " + str(i))

if __name__ == "__main__":
    # Set up default file path
    out_path = get_default_output_path()

    # Parse command line arguments
    parser = optparse.OptionParser(usage="%prog [options] [output_file" + DEFAULT_FILE_EXTENSION + "]")
    parser.add_option("-w", "--capture-window", action="store_true", dest="capture_window",
                      default=False,
                      help="prompt user to click on a window to capture")
    parser.add_option("-n", "--no-audio", action="store_true", dest="no_audio",
                      default=False,
                      help="don't capture audio")
    parser.add_option("-r", "--fps", dest="fps",
                      type="int", default=DEFAULT_FPS,
                      help="frame rate to capture video at. Default: " + str(DEFAULT_FPS))
    parser.add_option("-p", "--position", dest="xy", metavar="XxY",
                      type="string", default=None,
                      help="upper left corner of the capture area (in pixels from the upper left of the screen). Default: 0x0")
    parser.add_option("-s", "--size", dest="size",
                      type="string", default=None, metavar="WIDTHxHEIGHT",
                      help="resolution of the capture area (in pixels). Default: entire desktop")
    parser.add_option("--crop-top", dest="crop_top",
                      type="int", default=0,
                      help="number of pixels to crop off the top of the capture area")
    parser.add_option("--crop-bottom", dest="crop_bottom",
                      type="int", default=0,
                      help="number of pixels to crop off the bottom of the capture area")
    parser.add_option("--crop-left", dest="crop_left",
                      type="int", default=0,
                      help="number of pixels to crop off the left of the capture area")
    parser.add_option("--crop-right", dest="crop_right",
                      type="int", default=0,
                      help="number of pixels to crop off the right of the capture area")
    parser.add_option("-a", "--audio-device", dest="audio_device",
                      default=DEFAULT_CAPTURE_AUDIO_DEVICE,
                      help="the audio device to capture from (eg. hw:0).  Default: " + DEFAULT_CAPTURE_AUDIO_DEVICE)
    parser.add_option("-d", "--display-device", dest="display_device",
                      default=DEFAULT_CAPTURE_DISPLAY_DEVICE,
                      help="the display device to capture from (eg. :0.0).  Default: " + DEFAULT_CAPTURE_DISPLAY_DEVICE)
    parser.add_option("--acodec", dest="acodec",
                      default=DEFAULT_AUDIO_CODEC,
                      help="the audio codec to encode with.  Default: " + DEFAULT_AUDIO_CODEC)
    parser.add_option("--vcodec", dest="vcodec",
                      default=DEFAULT_VIDEO_CODEC,
                      help="the video codec to encode with.  Default: " + DEFAULT_VIDEO_CODEC)
    parser.add_option("--codecs", action="store_true", dest="list_codecs",
                      default=False,
                      help="display the available audio and video codecs")

    opts, args = parser.parse_args()

    # Print list of codecs, if requested
    if opts.list_codecs:
        print_codecs()
        exit(0)

    # Output file path
    if len(args) >= 1:
        out_path = args[0]
        if out_path[-4:] not in ACCEPTABLE_FILE_EXTENSIONS:
            out_path += DEFAULT_FILE_EXTENSION

    # Get desktop resolution
    try:
        dres = get_desktop_resolution()
    except:
        print("Error: unable to determine desktop resolution.")
        raise

    # Capture values
    fps = opts.fps
    if opts.capture_window:
        print("Please click on a window to capture.")
        x, y, width, height = get_window_position_and_size()
    else:
        if opts.xy:
            if re.match("^[0-9]*x[0-9]*$", opts.xy.strip()):
                xy = opts.xy.strip().split("x")
                x = int(xy[0])
                y = int(xy[1])
            else:
                raise parser.error("position option must be of form XxY (e.g. 50x64)")
        else:
            x = 0
            y = 0

        if opts.size:
            if re.match("^[0-9]*x[0-9]*$", opts.size.strip()):
                size = opts.size.strip().split("x")
                width = int(size[0])
                height = int(size[1])
            else:
                raise parser.error("size option must be of form HxW (e.g. 1280x720)")
        else:
            width = dres[0]
            height = dres[1]

    # Calculate cropping
    width -= opts.crop_left + opts.crop_right
    height -= opts.crop_top + opts.crop_bottom
    x += opts.crop_left
    y += opts.crop_top

    # Make sure the capture resolution conforms to the restrictions
    # of the video codec.  Crop to conform, if necessary.
    mults = {"h264": 2, "h264_fast": 2, "mpeg4": 2, "dirac": 2, "xvid": 2, "theora": 8, "huffyuv": 2, "vp8": 1}
    width -= width % mults[opts.vcodec]
    height -= height % mults[opts.vcodec]

    # Verify that capture area is on screen
    if (x + width) > dres[0] or (y + height) > dres[1]:
        parser.error("specified capture area is off screen.")

    # Capture!
    if not opts.no_audio:
        proc = subprocess.Popen(capture_line(fps, x, y, width, height, opts.display_device, opts.audio_device, opts.vcodec, opts.acodec, out_path)).wait()
    else:
        proc = subprocess.Popen(video_capture_line(fps, x, y, width, height, opts.display_device, opts.vcodec, out_path)).wait()

    print("Done!")

Bu kodları ev dizininde herhangi bir dizin içerisine(misal recordscreen dizini olsun) recordscreen.py adıyla kaydedin. Terminalden cd recordscreen./recordscreen.pykomutlarını kullanarak çalıştırın. AYnı dizin içerisine mkv uzantılı olarak kaydedecektir. Açıkçası en kaliteli kaydedici budur diyebilirim.


Mesaj tekrarı yüzünden mesajınız birleştirildi. Bu mesajın gönderim tarihi : 11 Kasım 2011 - 20:06:34

Alıntı YapTakılma konusunda sağlıklı bir yorum yapamayacağım, daha yüksek özellikte bilgisayarı olan arkadaşlardan da dinlemek gerek.
i7 işlemcide takılma olmuyor. Bir iki defa denemiştim o sırada ses kaydetmiyor diye aklımda kalmıştı ama meğer mikrofon rahmetli olmuş.

Dosya uzantısını değiştirirken
DEFAULT_FILE_EXTENSION = ".mkv" satırını mı değiştiriyoruz?
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: eribol - 12 Kasım 2011 - 20:33:20
Hiçbir şeyi değiştirmeye gerek yok. O komutları alıp herhangi bir isimle kaydedebilirsiniz.
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: heartsmagic - 13 Kasım 2011 - 00:10:20
@eribol, yanlış anlamışsın sanırım. Kayıt edilebilen biçimler arasında diğerleri de var hani, onu sormuş @maydin95. Benim gördüğüm oranın değiştirileceği. .avi, .mov da yapabiliyormuş uygulama yanlış görmüyorsam.
Başlık: Ynt: Masaüstü Kaydedici
Gönderen: eribol - 13 Kasım 2011 - 00:19:11
Evet haklısın @heartsmagic.
Alıntı YapACCEPTABLE_FILE_EXTENSIONS = [".avi", ".mp4", ".mov", ".mkv", ".ogv"]
buradaki uzantıları kabul ediyor sanırsam.