Code Monkey home page Code Monkey logo

Comments (3)

k4yt3x avatar k4yt3x commented on May 9, 2024

@cr08 I'll have to thank you before I get to what you've just said. I love getting useful and well structured suggestions like yours from the community.

And to answer each of your points:

  1. Yes, I agree that video2x isn't handling streams very well. I'll have to read deeper into how video/audio streams work before I can enhance the experience properly.

  2. You can already add FFMPEG arguments manually in video2x.json in a few updates ago, but I still want to give the user more control over what's being passed to FFMPEG. You can also define the encoding by just changing the suffix of the output video I believe. As for extra arguments for waifu2x-caffe, I'll make it happen.

  3. That's a good idea, I'll add a cache folder setting in the config file (video2x.json).

from video2x.

cr08 avatar cr08 commented on May 9, 2024

I think I've figured out the stream bit after toying around with ffmpeg and finding some obscure superuser.com posts. This is essentially what I have come up with:

ffmpeg -i ORIG_VIDEO.mkv -i upscaled\no_audio.mp4 -map 1:v:0 -map 0 -c copy -map -0:v FINAL_MUX.mkv

This is assuming the original video is still intact during this process which it should be. We are initially pulling in both the original with all streams as well as the newly upscaled video only stream. -map 1 :v :0 says we want to start right off the top with the newly upscaled video stream from the second input file to take precedence as stream 0 in the final mux. -map 0 has us taking every stream, video, audio, subtitles, and otherwise, from the original video and -c copy obviously has us copying it all over without any re-encoding. -map -0:v (see the extra hyphen at -0, which eluded me for some time as an option) says any video streams in the original video we will ignore and will not make it into the final mux.

As for the ffmpeg arguments bit, I am aware of that. However in its current state it applies to all stages that use ffmpeg equally which may not be desired. ie: The scenario I made above about needing to crop the source video before exporting frames. That crop filter will not apply well on the h264 encode after everything is upscaled for example. I will admit, however, that it may be a limited use case.

Additionally certain options in ffmpeg are sensitive to what order the arguments are in which makes it even more of a pain. Honestly I'm not even sure at this point how to accomplish that in the cleanest way possible.

from video2x.

k4yt3x avatar k4yt3x commented on May 9, 2024

@cr08 Thanks for the explaination for the map option.

The most ideal way for this project to be written will be to use the python-ffmpeg library instead of the ffmpeg binary. I still really want to look into the library.

The only way I can add customization into every ffmpeg command is to create a separate entry for every ffmpeg command executed, which will be quite some work, and deosn't seem very elegant.

I'm pretty busy recerntly with my school work, I'll take a look at how to improve this script once I'm done with this intense period of time.

from video2x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.