VideoHelp Forum
+ Reply to Thread
Results 1 to 17 of 17
Thread
  1. For those who want to scriptwise and at free will, Single Pass, play some with ffmpeg and x264.

    Code:
    Enjoy your own.
    Last edited by M.Shiver; 4th Nov 2023 at 20:39. Reason: Update
    Quote Quote  
  2. (Addendum to ffmpeg/x264 conversion script)

    For those who want to scriptwise and at free will play some with purifying the names of their files first from spaces, dots and special characters (except underscore and hyphen) and certain accentuated letters.

    Code:
    Enjoy your own.
    Last edited by M.Shiver; 4th Nov 2023 at 20:39.
    Quote Quote  
  3. What's the point of this other than for you to practice shell scripting?

    It's already easy to use ffmpeg from the command line, you have added a layer of abstraction that does nothing.
    Quote Quote  
  4. users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  5. Originally Posted by sophisticles View Post
    What's the point of this other than for you to practice shell scripting?

    It's already easy to use ffmpeg from the command line, you have added a layer of abstraction that does nothing.
    No comment.
    Last edited by M.Shiver; 7th Nov 2023 at 05:10.
    Quote Quote  
  6. Originally Posted by Selur View Post
    Nice.
    Last edited by M.Shiver; 7th Nov 2023 at 05:12.
    Quote Quote  
  7. Member
    Join Date
    Mar 2011
    Location
    Nova Scotia, Canada
    Search Comp PM
    Originally Posted by sophisticles View Post
    What's the point of this other than for you to practice shell scripting?

    It's already easy to use ffmpeg from the command line, you have added a layer of abstraction that does nothing.
    that's what I was thinking. Why not just use Handbrake? Isn't the whole point of doing encoding using CLI programs like ffmpeg to be able to use features unavailable in something like Handbrake? IMHO this is just pseudo console jockey rubbish, and I first learned Unix stuff in the 80s. CLI was the only option then.
    Quote Quote  
  8. Originally Posted by Hoser Rob View Post
    Originally Posted by sophisticles View Post
    What's the point of this other than for you to practice shell scripting?

    It's already easy to use ffmpeg from the command line, you have added a layer of abstraction that does nothing.
    that's what I was thinking. Why not just use Handbrake? Isn't the whole point of doing encoding using CLI programs like ffmpeg to be able to use features unavailable in something like Handbrake? IMHO this is just pseudo console jockey rubbish, and I first learned Unix stuff in the 80s. CLI was the only option then.
    No comment.
    Last edited by M.Shiver; 7th Nov 2023 at 05:10.
    Quote Quote  
  9. Don't mind them, yes, you can automatize custom processes, that's the point and fun as well. Everyone has to start somehow, small steps. I recommend peeking at python also, I have it even preinstalled on Ubuntu. If that is a fun for you, with python, you can actually end up using custom apps with ui etc.
    Quote Quote  
  10. Originally Posted by _Al_ View Post
    Don't mind them, yes, you can automatize custom processes, that's the point and fun as well. Everyone has to start somehow, small steps. I recommend peeking at python also, I have it even preinstalled on Ubuntu. If that is a fun for you, with python, you can actually end up using custom apps with ui etc.
    No comment.
    Last edited by M.Shiver; 7th Nov 2023 at 05:10.
    Quote Quote  
  11. Originally Posted by M.Shiver View Post
    Originally Posted by _Al_ View Post
    Don't mind them, yes, you can automatize custom processes, that's the point and fun as well. Everyone has to start somehow, small steps. I recommend peeking at python also, I have it even preinstalled on Ubuntu. If that is a fun for you, with python, you can actually end up using custom apps with ui etc.
    The bash script form of my bash scripts has been posted as bash script because the title of the post also says 'bash script'.

    Who says there is nothing else?

    I read a lot of small talk here, but I don't see any coding, any contribution.

    It wouldn't surprise me that some of the apparent Linux Expert comments are written from within Windows.

    Consequently it wouldn't surprise me that noone has even tried those scripts out (except maybe a user named 'Selur' - just maybe, lol).

    Although it could be of concrete, constructive relevance to me to know if or if not the scripts show bizarre behavior on other linux systems.

    No offense
    What you are doing is amateur hour, and frankly has existed for decades, you have contributed nothing of value.

    If you really want to do something of note, install Lazarus and Free Pascal and create a nice cross platform GUI.

    Another option is Pure Basic, which works much like the old Visual Basic did.

    You can also go the Python route, since Python is a language that is in big demand, so practicing it may actually lead you to one day landing a good paying job.

    Here is a simple Python GUI to get you started:

    import tkinter as tk
    from tkinter import messagebox
    from tkinter import font

    def on_button_click():
    messagebox.showinfo("Sophisticles", "WHATEVER")

    # Create the main application window
    root = tk.Tk()
    root.title("FFMPEG Batch Converter")

    # Set the window size to a predefined width and height
    root.geometry("800x600")

    # Create a font with a larger size
    custom_font = font.nametofont("TkDefaultFont")
    custom_font.configure(size=18)

    # Create a button
    button = tk.Button(root, text="Punch ME!", command=on_button_click, width=20, height=6, font=custom_font)
    button.pack()

    # Run the application
    root.mainloop()


    This will run on both Linux and Windows.

    As a general rule of thumb, I do not recommend on coding anything only for one specific OS, you always want to make it as cross platform as possible.
    Quote Quote  
  12. Originally Posted by sophisticles View Post
    Originally Posted by M.Shiver View Post
    Originally Posted by _Al_ View Post
    Don't mind them, yes, you can automatize custom processes, that's the point and fun as well. Everyone has to start somehow, small steps. I recommend peeking at python also, I have it even preinstalled on Ubuntu. If that is a fun for you, with python, you can actually end up using custom apps with ui etc.
    The bash script form of my bash scripts has been posted as bash script because the title of the post also says 'bash script'.

    Who says there is nothing else?

    I read a lot of small talk here, but I don't see any coding, any contribution.

    It wouldn't surprise me that some of the apparent Linux Expert comments are written from within Windows.

    Consequently it wouldn't surprise me that noone has even tried those scripts out (except maybe a user named 'Selur' - just maybe, lol).

    Although it could be of concrete, constructive relevance to me to know if or if not the scripts show bizarre behavior on other linux systems.

    No offense
    As a general rule of thumb, I do not recommend on coding anything only for one specific OS, you always want to make it as cross platform as possible.
    Unless you happen to find yourself in some forum thread meant for a specific OS.
    Last edited by M.Shiver; 7th Nov 2023 at 05:11.
    Quote Quote  
  13. Dont take some responses too much, public forum gives you hard responses, I know you just start, small steps, you are just fine.

    Regarding python script, it can have a lots of different approaches and degrees of difficulty, which means more user comfort.
    To start with basics, to run a command with bunch of defaults set beforehand, you can run something like this:
    Code:
    import multiprocessing
    from subprocess import Popen, PIPE
    from pathlib import Path
    import sys
    import shlex
    import shutil
    
    FFMPEG = shutil.which("ffmpeg")
    if not FFMPEG:
        raise ValueError("Executable ffmpeg is not in the PATH")
    THREADS         = multiprocessing.cpu_count()
    VID_IN          = ""
    EXT_OUT         = "mkv"
    FFMPEG_X264_VID = "-x264-params crf=18"
    FFMPEG_X264_VIDFIXED = ""
    FFMPEG_X264_AUD      = "aac -b:a 80k -ac 2 -ar 44100 "
    
    def main(filepaths):
        for VID_IN in filepaths:
            VID_IN = Path(VID_IN)
            if not VID_IN.is_file():
                raise ValueError(f"Not a file: {VID_IN}")
            output = VID_IN.parent / f"{VID_IN.stem}_converted.{EXT_OUT}"
            cmd = f'"{FFMPEG}" -y  -i "{VID_IN}"  -c:v libx264 {FFMPEG_X264_VID} {FFMPEG_X264_VIDFIXED} -c:a {FFMPEG_X264_AUD} "{output}"'
            print(cmd)
            p = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE, universal_newlines=True)
            line = 1
            while line:
                line = p.stderr.readline()
                print(line.strip())
            
    if __name__ == '__main__':
        if len(sys.argv) > 1:
            main(sys.argv[1:])
        else:
            raise ValueError("No filepath arguments")
    I based it on your defaults and simplify it. You name this basic_encoder.py and by dropping a file or more files, it will encode them.
    Or it can be called :
    python3 basic_encoder.py file1.mp4 file2.mp4 etc.
    or you can call encoding from another python file:
    import basic_encoder
    file = "/home/files/video.mp4" #windows: "D:/video.mp4" or r"D:\video.mp4"
    basic_encoder.main([file])

    you can do all kind of wizardry with python scripts, printing could be changed or just log things instead of printing it, or as was suggested, those defaults could be in a UI and just pushing a button would start things ...

    EDIT:
    Just tested it on Ubuntu and dropping files does not work, or I do not know how to do it in linux.
    But calling from other python scripts work or running cmd in terminal works (use full paths, those could be dropped there on terminal, manually punch spaces in between):
    python3 basic_encoder.py file1.mp4
    Last edited by _Al_; 4th Nov 2023 at 23:07.
    Quote Quote  
  14. Originally Posted by _Al_ View Post
    Dont take some responses too much, public forum gives you hard responses, I know you just start, small steps, you are just fine.
    No comment.
    Last edited by M.Shiver; 7th Nov 2023 at 05:11.
    Quote Quote  
  15. Fair enough. Im sorry for that insulting tone. I thought you are a kid, starting to launch automatized scripts for a custom procedures.
    Quote Quote  
  16. Member
    Join Date
    Mar 2011
    Location
    Nova Scotia, Canada
    Search Comp PM
    Originally Posted by M.Shiver View Post
    Originally Posted by Hoser Rob View Post
    Originally Posted by sophisticles View Post
    What's the point of this other than for you to practice shell scripting?

    It's already easy to use ffmpeg from the command line, you have added a layer of abstraction that does nothing.
    that's what I was thinking. Why not just use Handbrake? Isn't the whole point of doing encoding using CLI programs like ffmpeg to be able to use features unavailable in something like Handbrake? IMHO this is just pseudo console jockey rubbish, and I first learned Unix stuff in the 80s. CLI was the only option then.
    Batch/bulk processing, automating, fine tuning, less overhead, speed, that's why.....
    None of which is in your "quick & dirty" script. LMAO. Damn web posers. Besides, Avidemux will do batch processing too.
    Quote Quote  
  17. Originally Posted by Hoser Rob View Post
    Originally Posted by M.Shiver View Post
    Originally Posted by Hoser Rob View Post
    Originally Posted by sophisticles View Post
    What's the point of this other than for you to practice shell scripting?

    It's already easy to use ffmpeg from the command line, you have added a layer of abstraction that does nothing.
    that's what I was thinking. Why not just use Handbrake? Isn't the whole point of doing encoding using CLI programs like ffmpeg to be able to use features unavailable in something like Handbrake? IMHO this is just pseudo console jockey rubbish, and I first learned Unix stuff in the 80s. CLI was the only option then.
    Batch/bulk processing, automating, fine tuning, less overhead, speed, that's why.....
    None of which is in your "quick & dirty" script. LMAO. Damn web posers. Besides, Avidemux will do batch processing too.
    You're not kidding; reading through his posts I was reminded of that scene from the Waterboy when Adam Sandler calls that wrestler and asks if he needs the services of an experienced waterboy and when they find out that he's a grown man they bust out laughing.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!