fork download
  1. import tkinter as tk
  2. import tkinter.filedialog as tk_fd
  3. import subprocess
  4.  
  5. ffmpeg_path = "C:\\Users\\username\\Downloads\\ffmpeg-20160428-git-78baa45-win64-static\\bin\\ffmpeg.exe"
  6.  
  7. class Application(tk.Frame):
  8.  
  9. def __init__(self, master=None):
  10. super().__init__(master)
  11. self.pack()
  12.  
  13. self.mp3_path = ''
  14. self.pic_path = ''
  15. self.output_path = ''
  16.  
  17. self.create_widgets()
  18.  
  19. def create_widgets(self):
  20. self.Source1 = tk.Button(self, text = "mp3", command = lambda: self.open_mp3()).pack()
  21. self.Sourse2 = tk.Button(self, text = "pic", command = lambda: self.open_pic()).pack()
  22. self.Start = tk.Button(self, text="Start", fg="red",command= lambda: self.start()).pack()
  23.  
  24. def open_mp3(self):
  25. op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
  26. path = (str(op.name).replace("""/""","""\\""")) #this is path to music source #have to do smth with russian chars
  27. print("Path to mp3 is - " + path)
  28. self.mp3_path = path
  29.  
  30. def open_pic(self):
  31. op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
  32. path = (str(op.name).replace("""/""","""\\""")) #this is path to pic source #have to do smth with russian chars
  33. print("Path to pic is - " + path)
  34. self.pic_path = path
  35.  
  36. def start(self):
  37. op = tk_fd.asksaveasfilename(title = "Choose where to save", filetypes = [("webm", "*.webm;")])
  38. path = (str(op).replace("""/""","""\\""")+(".webm")) #this is path to webm output #have to do smth with russian chars
  39. print("Path to webm is - " + path)
  40. self.output_path = path
  41.  
  42. subprocess.call(ffmpeg_path + self.parse_setting())
  43.  
  44. def parse_setting(self):
  45. #there must be smth to parse when settings will be done
  46. settings = " -r 1 -loop 1 -i {} -i {} -c:v vp8 -c:a opus -b:a 128k -b:v 0 -crf 16 -g 360 -shortest {}".format(self.pic_path, self.mp3_path, self.output_path)
  47. print((ffmpeg_path + settings))
  48. return(settings)
  49.  
  50.  
  51. root = tk.Tk()
  52. root.geometry("800x600")
  53. root.title("GUI: mp3 + pic = webm")
  54. app = Application(master=root)
  55. app.mainloop()
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: '.' expected
import tkinter as tk
              ^
Main.java:1: error: ';' expected
import tkinter as tk
                 ^
Main.java:2: error: ';' expected
import tkinter.filedialog as tk_fd
                         ^
Main.java:3: error: '.' expected
import subprocess
                 ^
Main.java:5: error: ';' expected
ffmpeg_path = "C:\\Users\\username\\Downloads\\ffmpeg-20160428-git-78baa45-win64-static\\bin\\ffmpeg.exe"
           ^
Main.java:7: error: '{' expected
class Application(tk.Frame):
                 ^
Main.java:13: error: empty character literal
        self.mp3_path = ''
                        ^
Main.java:13: error: illegal line end in character literal
        self.mp3_path = ''
                         ^
Main.java:14: error: empty character literal
        self.pic_path = ''
                        ^
Main.java:14: error: illegal line end in character literal
        self.pic_path = ''
                         ^
Main.java:15: error: empty character literal
        self.output_path = ''
                           ^
Main.java:15: error: illegal line end in character literal
        self.output_path = ''
                            ^
Main.java:25: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
                                    ^
Main.java:25: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
                                       ^
Main.java:25: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
                                               ^
Main.java:25: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
                                                            ^
Main.java:26: error: illegal character: '#'
        path = (str(op.name).replace("""/""","""\\""")) #this is path to music source #have to do smth with russian chars
                                                        ^
Main.java:26: error: illegal character: '#'
        path = (str(op.name).replace("""/""","""\\""")) #this is path to music source #have to do smth with russian chars
                                                                                      ^
Main.java:31: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
                                    ^
Main.java:31: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
                                       ^
Main.java:31: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
                                               ^
Main.java:31: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
                                                                ^
Main.java:31: error: illegal character: '#'
        op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
                                                                                                                            ^
Main.java:31: error: illegal character: '#'
        op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
                                                                                                                                                            ^
Main.java:32: error: illegal character: '#'
        path = (str(op.name).replace("""/""","""\\""")) #this is path to pic source #have to do smth with russian chars
                                                        ^
Main.java:32: error: illegal character: '#'
        path = (str(op.name).replace("""/""","""\\""")) #this is path to pic source #have to do smth with russian chars
                                                                                    ^
Main.java:38: error: illegal character: '#'
        path = (str(op).replace("""/""","""\\""")+(".webm")) #this is path to webm output #have to do smth with russian chars
                                                             ^
Main.java:38: error: illegal character: '#'
        path = (str(op).replace("""/""","""\\""")+(".webm")) #this is path to webm output #have to do smth with russian chars
                                                                                          ^
Main.java:45: error: illegal character: '#'
        #there must be smth to parse when settings will be done
        ^
Main.java:55: error: reached end of file while parsing
app.mainloop()
              ^
30 errors
stdout
Standard output is empty