{"id":87053,"date":"2023-02-16T09:10:52","date_gmt":"2023-02-16T03:40:52","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=87053"},"modified":"2026-06-03T16:00:00","modified_gmt":"2026-06-03T10:30:00","slug":"python-video-to-audio-converter","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/","title":{"rendered":"Python Video to Audio Converter &#8211; Audio Extraction Made Effortless"},"content":{"rendered":"<p>In this project, we will create a python video to audio converter project using Tkinter module and Pydub library. This project will have a GUI that allows users to browse and select a video file and an output location to save the converted audio file.<\/p>\n<h3>Python Video to Audio Converter<\/h3>\n<p>The objective of Python Video to Audio Converter is to demonstrate how to create a simple video to audio converter project using Python&#8217;s Tkinter module and Pydub library.<\/p>\n<h3>Prerequisites for Video to Audio Converter using Python<\/h3>\n<ul>\n<li style=\"font-weight: 400;\">Basic understanding of Python programming<\/li>\n<li style=\"font-weight: 400;\">Basic understanding of Tkinter module<\/li>\n<li style=\"font-weight: 400;\">Pydub library installed (can be installed using pip by running &#8220;pip install pydub&#8221;)<\/li>\n<\/ul>\n<h3>Download Python Video to Audio Converter Project<\/h3>\n<p>Please download the source code of python Video to Audio Converter project from the following link: <a href=\"https:\/\/drive.google.com\/file\/d\/1eIhuscXsVUHb6BitW-EyeqRCQTZBdxsX\/view?usp=drive_link\"><strong>Python Video to Audio Converter Code<\/strong><\/a><\/p>\n<h3>Steps to Create Video to Audio Converter using Python<\/h3>\n<p>Following are the steps for developing the python Video to Audio Converter project:<\/p>\n<h4>Step 1: Importing Libraries<\/h4>\n<p>Before we start creating the GUI for our project, we need to import the required libraries. In this case, we will be importing Tkinter for creating the GUI, filedialog for browsing files, Pydub for converting the video to audio and messagebox for displaying success messages.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Importing the required libraries\r\nimport tkinter as tk\r\nfrom tkinter import filedialog\r\nfrom pydub import AudioSegment\r\nfrom tkinter import messagebox\r\n<\/pre>\n<h4>Step 2: Creating the main window<\/h4>\n<p>In this step, we will create the main window for our project using the Tk() method from the Tkinter module. We will also set the title, background color, and size of the window.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Creating main window\r\nroot = tk.Tk()\r\n\r\n\r\n# Setting the title, background color and size of the tkinter window and resizing property\r\nroot.title(\"TechVidvan - Video to Audio Converter\")\r\nroot.geometry(\"600x310\")\r\nroot.resizable(width=False, height=False)\r\nroot.configure(background=\"#3b4370\")\r\n<\/pre>\n<h4>Step 3: Creating the browse input function<\/h4>\n<p>In this step, we will create a function which will allow users to browse and select a video file. We will use the askopenfilename() method from the filedialog module to open the file browser and select a file. The selected file path will be displayed in a label on the GUI.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># function to browse input file\r\ndef browse_input_command():\r\n    global file_path\r\n    file_path = filedialog.askopenfilename(initialdir=\"\/\", title=\"Select file\", filetypes=((\"mp3 files\", \"*.mp4\"), (\"all files\", \"*.*\")))\r\n  \r\n   # display file path in label\r\n    input_file_path_label.config(text=file_path)\r\n<\/pre>\n<h4>Step 4: Creating the browse output function<\/h4>\n<p>In this step, we will create a function which will allow users to browse and select a location to save the converted audio file. We will use the asksaveasfilename() method from the filedialog module to open the file browser and select a location. The selected location will be displayed on a label on the GUI.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># function to browse output file\r\ndef browse_output_command():\r\n    global output_path\r\n    output_path = filedialog.asksaveasfilename(initialdir=\"\/\", title=\"Save file as\", filetypes=((\"mp3 files\", \"*.mp3\"), (\"all files\", \"*.*\")))\r\n  \r\n   # display file path in label\r\n    output_file_path_label.config(text=output_path)\r\n<\/pre>\n<h4>Step 5: Creating the convert function<\/h4>\n<p>We will now create the function that will convert the video file to audio. In this function, we will use the AudioSegment.from_file() method from the pydub library to convert the video file to audio. We will then use the export() method to save the audio file to the specified output path.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def convert_command():\r\n\r\n\r\n   # convert video to audio\r\n    video = AudioSegment.from_file(file_path)\r\n\r\n\r\n   # save audio file\r\n    video.export(output_path, format=\"mp3\")\r\n\r\n\r\n   # show success message\r\n    messagebox.showinfo(\"Success\", \"Video converted to Audio successfully\")\r\n<\/pre>\n<h4>Step 6: Creating the GUI<\/h4>\n<p>The next step is to create the Graphical User Interface (GUI) for our project. We will use the Tkinter library for this purpose.<\/p>\n<p>In this step, we will create various elements such as labels, buttons and file path labels that will be used in the project. These elements are created using the Tkinter classes such as Label, Button, and Entry.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Create a label to display the title\r\ntitle_label=tk.Label(root)\r\ntitle_label.configure(background=\"#90f090\", foreground=\"#333333\", font=\"Arial 18 bold\", justify=\"center\", text=\"TechVidvan - Video to Audio Converter\")\r\ntitle_label.place(x=0,y=0,width=600,height=50)\r\n\r\n\r\n# Create a button to browse input file\r\nbrowse_input_button=tk.Button(root)\r\nbrowse_input_button.configure(font=\"Arial 14\", justify=\"center\", text=\"Browse Input\", command=browse_input_command)\r\nbrowse_input_button.place(x=30,y=80,width=160,height=40)\r\n\r\n\r\n# Create a label to display file path\r\ninput_file_path_label=tk.Label(root)\r\ninput_file_path_label.configure(background=\"#3b4370\", foreground=\"#ffffc5\", font=\"Arial 14\", justify=\"center\", text=\"File Path\")\r\ninput_file_path_label.place(x=220,y=80,width=360,height=40)\r\n\r\n\r\n# Create a button to browse output file\r\nbrowse_output_button=tk.Button(root)\r\nbrowse_output_button.configure(font=\"Arial 14\", justify=\"center\", text=\"Output Path \", command=browse_output_command)\r\nbrowse_output_button.place(x=30,y=150,width=160,height=40)\r\n\r\n\r\n# Create a label to display file path\r\noutput_file_path_label=tk.Label(root)\r\noutput_file_path_label.configure(background=\"#3b4370\", foreground=\"#ffffc5\", font=\"Arial 14\", justify=\"center\", text=\"File Path\")\r\noutput_file_path_label.place(x=220,y=150,width=360,height=40)\r\n\r\n\r\n# Create a button to convert video to audio\r\nconvert_button=tk.Button(root)\r\nconvert_button.configure(font=\"Arial 14\", justify=\"center\", text=\"Convert\", command=convert_command)\r\nconvert_button.place(x=220,y=240,width=160,height=40)\r\n<\/pre>\n<h4>Step 7: Running the main loop<\/h4>\n<p>The final step is to run the main loop of the project using the root.mainloop() command. This command is responsible for keeping the project running and handling all the user interactions.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Run the main window loop\r\nroot.mainloop()\r\n<\/pre>\n<h3>Python Video to Audio Converter Output<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87125 size-full\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/python-video-to-audio-convertor.webp\" alt=\"python video to audio converter output\" width=\"1200\" height=\"676\" \/><\/p>\n<h3><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87126 size-full\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/video-to-audio-convertor.webp\" alt=\"video to audio converter output\" width=\"2106\" height=\"1454\" \/><\/h3>\n<h3>Summary:<\/h3>\n<p>Congratulations! You have successfully created a video to audio converter project using Tkinter in Python. In this Python Video to Audio Converter, we learned how to create a video to audio converter project using the Tkinter library in Python. You can now use this project to convert any video file to an audio file in MP3 format.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this project, we will create a python video to audio converter project using Tkinter module and Pydub library. This project will have a GUI that allows users to browse and select a video&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":87124,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1053],"tags":[4762,483,3249,1207,4858,4859,4860,4861],"class_list":["post-87053","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-basic-python-project","tag-python-project","tag-python-project-for-beginners","tag-python-project-for-practice","tag-python-video-to-audio-converter","tag-python-video-to-audio-converter-project","tag-video-to-audio-converter","tag-video-to-audio-converter-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Video to Audio Converter - Audio Extraction Made Effortless - TechVidvan<\/title>\n<meta name=\"description\" content=\"Video to audio converter convert your video to audio and video to mp3 by using Tkinter module and Pydub library in Python.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Video to Audio Converter - Audio Extraction Made Effortless - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Video to audio converter convert your video to audio and video to mp3 by using Tkinter module and Pydub library in Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-16T03:40:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-03T10:30:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/02\/python-project-video-to-audio-convertor.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Video to Audio Converter - Audio Extraction Made Effortless - TechVidvan","description":"Video to audio converter convert your video to audio and video to mp3 by using Tkinter module and Pydub library in Python.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/","og_locale":"en_US","og_type":"article","og_title":"Python Video to Audio Converter - Audio Extraction Made Effortless - TechVidvan","og_description":"Video to audio converter convert your video to audio and video to mp3 by using Tkinter module and Pydub library in Python.","og_url":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2023-02-16T03:40:52+00:00","article_modified_time":"2026-06-03T10:30:00+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/02\/python-project-video-to-audio-convertor.webp","type":"image\/webp"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Python Video to Audio Converter &#8211; Audio Extraction Made Effortless","datePublished":"2023-02-16T03:40:52+00:00","dateModified":"2026-06-03T10:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/"},"wordCount":598,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/02\/python-project-video-to-audio-convertor.webp","keywords":["basic python project","Python project","python project for beginners","Python project for practice","python video to audio converter","python video to audio converter project","video to audio converter","video to audio converter project"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/","url":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/","name":"Python Video to Audio Converter - Audio Extraction Made Effortless - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/02\/python-project-video-to-audio-convertor.webp","datePublished":"2023-02-16T03:40:52+00:00","dateModified":"2026-06-03T10:30:00+00:00","description":"Video to audio converter convert your video to audio and video to mp3 by using Tkinter module and Pydub library in Python.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/02\/python-project-video-to-audio-convertor.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2023\/02\/python-project-video-to-audio-convertor.webp","width":1200,"height":628,"caption":"python project video to audio converter"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/python-video-to-audio-converter\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Python Video to Audio Converter &#8211; Audio Extraction Made Effortless"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/87053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=87053"}],"version-history":[{"count":2,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/87053\/revisions"}],"predecessor-version":[{"id":448161,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/87053\/revisions\/448161"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/87124"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=87053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=87053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=87053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}