Giter VIP home page Giter VIP logo

superview's Introduction

Superview

All Contributors

This is a small Go program that takes a 4:3 aspect ratio video file, and transforms it to a 16:9 video using the GoPro SuperView method. This means that the image is not naively scaled, but a dynamic scaling is applied where the outer areas are stretched more while the center parts stay close to the original aspect rate.

This is not a 1-1 copy of the GoPro algorithm, but an attempt to reach similar quality of output using the open-source FFmpeg encoder.

Credits for the idea go to Banelle, who wrote the initial (Python) implementation.

Here is a quick animation showing the scaling, note how the text in the center stays the same:

alt text

Requirements

This program requires FFmpeg to be installed on your computer. If needed, please install it using one of these ways:

  • Linux: install from your local package manager, for example: apt instal ffmpeg
  • Windows: Download from https://www.gyan.dev/ffmpeg/builds/ and extract the ffmpeg-release-full 7ZIP file in the same directory as superview
  • macOS: Download from https://evermeet.cx/ffmpeg/ and put in the same folder as superview, or install using Homebrew: brew install ffmpeg

Installation

Download the latest release from the releases page on GitHub. There are two versions: a graphical version called superview-gui and a command line program called superview-cli.

Usage

GUI

To run superview-gui, simply double-click the icon. Choose an input video file, optionally change some settings and click "Encode". The program will ask you where to save the output.

alt text

CLI

To use superview-cli, run the program with the -i (input file) parameter. Optionally, you can provide a -o (output) and -b (bitrate) parameter. Full usage instructions:

Usage:
  superview-cli [OPTIONS]

Application Options:
  -i, --input=FILE         The input video filename
  -o, --output=FILE        The output video filename (default: output.mp4)
  -e, --encoder=ENCODER    The encoder to use, use -h to see a list. If not specified, it takes the standard encoder of the input file codec
  -b, --bitrate=BITRATE    The bitrate in bytes/second to encode in. If not specified, take the same bitrate as the input file
  -s, --squeeze            Squeeze 4:3 video stretched to 16:9 (e.g. Caddx Tarsier 2.7k60)

Help Options:
  -h, --help               Show this help message

Development

If you want superview from source, run go build superview-gui.go or go build superview-cli.go depending on which version you'd like to build. See build.sh for an example how to cross-compile.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Roman Kuraev

🤔 💻

dangr0

🐛

DG

🤔 ⚠️

Nova_Max

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

superview's People

Contributors

allcontributors[bot] avatar dependabot[bot] avatar niek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

superview's Issues

Error running ffmpeg, output is: on Arch Linux

ffmpeg version: n4.3.1
Hardware accelerators: vdpau,cuda,vaapi,qsv,drm
H.264 encoders: libx264,libx264rgb,h264_nvenc,h264_omx,h264_qsv,h264_v4l2m2m,h264_vaapi
H.265/HEVC encoders: libx265,hevc_nvenc,hevc_qsv,hevc_v4l2m2m,hevc_vaapi
Scaling input file /home/mateusz/Dron/videos/RC_0056_2007292052.MP4 (codec: h264, duration: 326 secs) from 3840*2160 to 3840*2160 using superview scaling. Squeeze: true
Filter files generated
Re-encoding video with h264_qsv encoder at 57 MB/s bitrate
2020/08/01 22:00:44 Error running ffmpeg, output is:
&{%!s(*os.file=&{{{1 0 0} -1 {0} <nil> 0 0 true true true} |0 <nil> true false false})}

Can you help with that?
I just instaled and run the CLI version with a video from Runcam 5, recorded at 4K(XV) resolution.

Distortion falloff and protected area

Can we get some parameters to fine tune the width of the protected area and the distortion falloff? These are the names of the parameters in Stickman's Ultraview Nuke plugin.

Bitrate mismatch between source and result video, when not specifying bitrate per parameter

Hi,

i used the latest superview release with the ffmepg 4.13 on windows 10. My Input video has the following specs:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'source.MP4':
  Metadata:
    major_brand     : avc1
    minor_version   : 0
    compatible_brands: avc1isom
    creation_time   : 2019-07-05T19:14:43.000000Z
  Duration: 00:07:52.84, start: 0.000000, bitrate: 40804 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 2704x2028, 40483 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2019-07-05T19:14:43.000000Z
      handler_name    :  Ambarella AVC
      encoder         : Ambarella AVC encoder
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2019-07-05T19:14:43.000000Z
      handler_name    :  Ambarella AAC

the resulting video (which has amazing superview look, huge thanks for that!!!) has the following specs:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'superview.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:07:52.84, start: 0.000000, bitrate: 19103 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 3604x2028, 18966 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 128 kb/s (default)
    Metadata:
      handler_name    :  Ambarella AAC

as you can see, the bitrate in the result is 18966 kb/s vs the source's 40804 kb/s.
I called superview without the "-b" parameter, so i would expect the resulting bitrate to be around 40804 kb/s as well.

Notice Aliasing on rendered footage

Looks like the call to ffmpeg will benefit from some anti-aliasing flags.
Footage rendered from SuperView has jagged lines and other signs of aliasing when being processed.

Downloaded file won't open

When i try to open the downloaded file it opens for a milisec and dissapears. Also tried older versions. am i overseeing something?

Thanks in advance.

Cleaning up pgm files

Hi,
Great tool and really clean implementation thanks for bringing this to the community.

My only ask would be to have the CLI clean out the x.pgm and y.pgm files when encoding is completed.
Environment: MacOS 10.15.7

Output aspect ratio depends on input aspect ratio

There is a bug in line 74 of the code which calculates outX wrong for input files with an aspect ratio != 4:3. I noticed because my video was 5:4 and the output file was not 16:9.
Fix for converting all input files to 16:9 is quite trivial tho, simply calculate outX from input height * desired ratio:
outX := int(float64(specs.Streams[0].Height) * (16.0 / 9.0)) / 2 * 2 // multiplier of 2

Problem with "-x265-params log-level=error" on older ffmpeg versions

I was running ffmpeg version 4.0.2 which I had installed on my MacOS machine, but the -x265-params argument was causing the command not to execute. For backward compatibility maybe this argument isn't really necessary?

I updated to 4.1.3 and it works as expected, but this had me stumped for a little while.

Request: Log Verbose option

When I run into an ffmpeg error I just get output like
image

It would be very helpful if i could set an option to have ffmpeg log level more verbose instead of error.

I am running into this problem when converting a DNxHR video. Is this even supported? Could it be?

FFmpeg Link broken

Hello,
The FFmpeg link doesnt work anymore. What files is it looking for and where?

Error running ffmpeg with nvidia encoder

I got it to run with normal cpu encoding but when I try to use amd or nvidia via h264_nvenc and h264_amf since I have a laptop that has both amd and nvidia gpu I just get error

Re-encoding video with h264_nvenc encoder at 95 MB/s bitrate
2023/05/31 17:44:17 Error running ffmpeg, output is:
exit status 1

Anyone have any idea how to fix it? It works fine encoding with cpu

Small fix for (new) Runcam 5 Orange Camera to work with superview

superview.go.txt

Description: When running Superview.exe with an Runcam 5 Orange mp4 file as source, the program just exits/crashes with "exit code 1".

Analysis: When starting ffmpeg like superview does, the following error is printed:

[mp4 @ 000001a3a6666bc0] Could not find tag for codec pcm_s16le in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
Conversion failed!

Probable cause/solution:
It seems Runcam 5 Orange uses an audio codec that is not supported for MP4-ouput in ffmpeg.
In superview.go line 116 commenting out the following parameters in the ffmpeg command-call fixes the issue for me: "-c:a", "copy",
As I understand this, omitting the parameter lets ffmpeg choose the best fitting audio-codec by itself.

I attached version 0.3 with the "fix" included.

Encoding stats in GUI after completion

Would it be possible to get some basic stats about the encode after completion in the GUI? That could make testing different codecs easier for us simple folk. Thanks, loving it so far, works great with my RunCam Orange

Exit Status 22 when

Hi there

Currently I get Exit Status 22 when using the latest FFMPEG.

The original file format is HEVC, from a DJI Action 2.

I've tried both CLI or GUI with the same error. Not sure what's going on.

Any help?

`C:\Users\telmo\OneDrive\Videos\Superviou>superview-cli-windows-amd64-v0.10.exe /input test2.mp4 /o test300.mp4 /s /e hevc_nvenc
===> Superview - dynamic video stretching <===

  • ffmpeg version: 2023-06-27-git-9b6d191a66-full_build-www.gyan.dev
  • Hardware accelerators: cuda,dxva2,qsv,d3d11va,opencl,vulkan
  • H.264/H.265 encoders: libx264,libx264rgb,h264_amf,h264_mf,h264_nvenc,h264_qsv,libx265,hevc_amf,hevc_mf,hevc_nvenc,hevc_qsv

Scaling input file test2.mp4 (codec: hevc, duration: 16 secs) from 40963072 to 40963072 using superview scaling. Squeeze: true
Filter files generated
Re-encoding video with hevc_nvenc encoder at 95 MB/s bitrate
2023/07/02 20:55:07 Error running ffmpeg, output is:
exit status 22`

Support for NVENC

When manually converting I like to use NVENC, cause its 5 times faster on my rig. It would be awesome if that would be an option with SuperView.

The FFMPEG call would look something like
ffmpeg -vsync 0 -hwaccel cuvid -c:v h264_nvenc

Here is an example involving processing from NVIDIA
ffmpeg -vsync 0 –hwaccel cuvid -c:v h264_cuvid –resize 1280x720 -i input.mp4 -c:a copy -c:v h264_nvenc -b:v 5M output.mp4 from https://developer.nvidia.com/blog/nvidia-ffmpeg-transcoding-guide/

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.