{"id":125,"date":"2025-03-01T12:32:53","date_gmt":"2025-03-01T09:32:53","guid":{"rendered":"http:\/\/safakyuce.com.tr\/?p=125"},"modified":"2025-11-25T21:51:06","modified_gmt":"2025-11-25T18:51:06","slug":"python-video-birlestirme","status":"publish","type":"post","link":"https:\/\/safakyuce.com.tr\/?p=125","title":{"rendered":"Python video birle\u015ftirme"},"content":{"rendered":"\n<p>Bir fuar haz\u0131rl\u0131\u011f\u0131 s\u0131ras\u0131nda eldeki videolar\u0131 birle\u015ftirmem gerekti. \u0130nternetten ara\u015ft\u0131rarak ve yapay zeka kullanarak kodlar\u0131 buldum, kendimce d\u00fczenledim.<\/p>\n\n\n\n<p>Kullanmak i\u00e7in bir \u015fekilde bilgisayar\u0131n\u0131zda Python y\u00fckl\u00fc olmas\u0131 gerekti\u011fini unutmay\u0131n. <\/p>\n\n\n\n<p>A\u015fa\u011f\u0131daki kodu herhangi bir text edit\u00f6r\u00fcne (notepad) ekleyip, dosya uzant\u0131s\u0131 .py olarak kaydedin.<\/p>\n\n\n\n<p>Birle\u015ftirmek istedi\u011finiz dosyalar\u0131 ve kaydetti\u011finiz kod dosyas\u0131n\u0131 ayn\u0131 klas\u00f6r i\u00e7ine koyun. Klas\u00f6rde sadece kod dosyas\u0131 ve video dosyalar\u0131 olsun.<\/p>\n\n\n\n<p>Python i\u00e7inde kodu \u00e7al\u0131\u015ft\u0131rmak i\u00e7in gerekli k\u00fct\u00fcphaneleri eklemeniz gerekli. A\u015fa\u011f\u0131daki kodu kullanarak k\u00fct\u00fcphaneyi y\u00fckleyin. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install moviepy<\/code><\/pre>\n\n\n\n<p>Kod \u00e7al\u0131\u015ft\u0131ktan sonra \u00e7\u0131kt\u0131 dosyas\u0131n\u0131 ayn\u0131 klas\u00f6r i\u00e7inde &#8220;output.mp4&#8221; olarak bulabilirsiniz.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport inspect\nfrom moviepy import* #.editor import VideoFileClip, concatenate_videoclips\ndef get_script_directory():\n    \"\"\"Bu kod dosyas\u0131n\u0131n oldu\u011fu konumun adresini getirir. str tipinde dosya yolunu verir.\"\"\"\n    script_path = inspect.getfile(inspect.currentframe())\n    return os.path.dirname(os.path.abspath(script_path))\n    \ndef find_file_paths(folder_path, file_extensions=&#91;'mkv', 'mp4']):\n    # Sadece mkv ve mp4 uzant\u0131l\u0131 dosyalar\u0131 al\u0131r. Di\u011ferlerini de eklemek istersen file_extensions listesine ekle.\n    file_paths = &#91;]\n    \n    # Klas\u00f6rdeki t\u00fcm dosyalar\u0131 listeler\n    all_files = glob.glob(os.path.join(folder_path, '*'))\n    \n    # Belirli uzant\u0131lara sahip dosyalar\u0131 se\u00e7er\n    file_paths = &#91;file for file in all_files if file.lower().endswith(tuple(file_extensions))]\n    \n    return file_paths\n\ndef main():\n    filenames = find_file_paths (get_script_directory())\n    # bir \u00f6nceki versiyonda \u015fu \u015fekilde liste olarak veriyordum= &#91;\"cv2.mkv\",\"cv3.mkv\",\"cv4.mkv\",\"cv5.mkv\",\"cv6.mkv\",\"cv7.mkv\",\"cv8.mkv\",\"cv9.mkv\"]  \n    # Benzer bir i\u015flem os.listdir yada benzer bir kodla yap\u0131labilir.\n    clips = &#91;]\n\n    for file in filenames:\n        clips.append(VideoFileClip(file, target_resolution=(1920,1080)))\n\n    final_clip = concatenate_videoclips(clips,  method=\"compose\")  \n    # method=\"chain\" varsay\u0131lan. E\u011fer t\u00fcm videolar ayn\u0131 boyutlardaysa kullanabilirsin.\n    final_clip.write_videofile(\"out.mp4\")\n    \nif __name__ == '__main__':\n    main()<\/code><\/pre>\n\n\n\n<p>Kodu Python&#8217;da nas\u0131l \u00e7al\u0131\u015ft\u0131raca\u011f\u0131n\u0131z\u0131 bilmiyorsan\u0131z:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Python bilgisayar\u0131n\u0131zda y\u00fckl\u00fc de\u011filse <a href=\"https:\/\/www.python.org\">https:\/\/www.python.org<\/a> sitesinden indirip y\u00fckleyin.<\/li>\n\n\n\n<li>moviepy k\u00fct\u00fcphanesini yukar\u0131daki kodu komut sat\u0131r\u0131na yazarak y\u00fckleyin.<\/li>\n\n\n\n<li>Yeni bir klas\u00f6r a\u00e7\u0131p t\u00fcm videolar\u0131 buraya koyun.<\/li>\n\n\n\n<li>Yukar\u0131daki kodlar\u0131 herhangi bir yaz\u0131m edit\u00f6r\u00fcne yoksa &#8220;not defteri&#8221; uygulamas\u0131na yap\u0131\u015ft\u0131r\u0131p, herhangi bir isimle .py uzant\u0131l\u0131 olarak videolar\u0131n oldu\u011fu klas\u00f6re kaydedin. \u00d6rne\u011fin: videobirlestir.py<\/li>\n\n\n\n<li>Komut sat\u0131r\u0131n\u0131 a\u00e7\u0131p sadece videolar\u0131n ve kodun bulundu\u011fu klas\u00f6re gidin.<\/li>\n\n\n\n<li>&#8220;python videobirlestir.py&#8221; \u015feklinde siz kod dosyas\u0131n\u0131n ad\u0131n\u0131 ne verdiyseniz yerine onu yaz\u0131p, enter tu\u015funa bas\u0131n. Kod \u00e7al\u0131\u015fmay\u0131 bitirdi\u011finde komut sat\u0131r\u0131na geri d\u00f6necektir.<\/li>\n\n\n\n<li>Birle\u015ftirilmi\u015f video, videolar\u0131n ve kodun oldu\u011fu klas\u00f6rde output.mp4 olarak kaydedilecektir.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Bir fuar haz\u0131rl\u0131\u011f\u0131 s\u0131ras\u0131nda eldeki videolar\u0131 birle\u015ftirmem gerekti. \u0130nternetten ara\u015ft\u0131rarak ve yapay zeka kullanarak kodlar\u0131 buldum, kendimce d\u00fczenledim. Kullanmak i\u00e7in bir \u015fekilde bilgisayar\u0131n\u0131zda Python y\u00fckl\u00fc&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/safakyuce.com.tr\/?p=125\">Devam\u0131n\u0131 okuyun<span class=\"screen-reader-text\">Python video birle\u015ftirme<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[65],"tags":[66,67],"class_list":["post-125","post","type-post","status-publish","format-standard","hentry","category-python","tag-python","tag-video-birlestirme","entry"],"_links":{"self":[{"href":"https:\/\/safakyuce.com.tr\/index.php?rest_route=\/wp\/v2\/posts\/125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/safakyuce.com.tr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/safakyuce.com.tr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/safakyuce.com.tr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/safakyuce.com.tr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=125"}],"version-history":[{"count":3,"href":"https:\/\/safakyuce.com.tr\/index.php?rest_route=\/wp\/v2\/posts\/125\/revisions"}],"predecessor-version":[{"id":142,"href":"https:\/\/safakyuce.com.tr\/index.php?rest_route=\/wp\/v2\/posts\/125\/revisions\/142"}],"wp:attachment":[{"href":"https:\/\/safakyuce.com.tr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/safakyuce.com.tr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/safakyuce.com.tr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}