Video: Difference between revisions

From 太極
Jump to navigation Jump to search
(3 intermediate revisions by the same user not shown)
Line 12: Line 12:
* [https://www.linuxuprising.com/2019/04/hollywood-grade-video-editor-davinci.html Hollywood-Grade Video Editor DaVinci Resolve 16 Beta Released]
* [https://www.linuxuprising.com/2019/04/hollywood-grade-video-editor-davinci.html Hollywood-Grade Video Editor DaVinci Resolve 16 Beta Released]


== LosslessCut ==
== LosslessCut: ffmpeg frontend ==
* https://github.com/mifi/lossless-cut
* https://github.com/mifi/lossless-cut
* [https://www.linuxuprising.com/2019/01/free-video-cutter-losslesscut-adds.html?m=1 Free Video Cutter LosslessCut Adds Multiple Cut Points, Video Merging Feature]
* [https://www.linuxuprising.com/2019/01/free-video-cutter-losslesscut-adds.html?m=1 Free Video Cutter LosslessCut Adds Multiple Cut Points, Video Merging Feature]
Line 23: Line 23:
*# The speed is fast
*# The speed is fast


[[File:Losslesscut.png|250px]]
:[[File:Losslesscut.png|250px]]
 
* [https://linuxtldr.com/losslesscut/ LosslessCut: A GUI Front-End for FFmpeg for Audio/Video Editing]
 
== ffmpeg for video trimmer ==
[https://stackoverflow.com/a/42827058 Cutting the videos based on start and end time using ffmpeg]. It's very fast from my testing.
<pre>
ffmpeg -ss 00:01:00 -to 00:02:00 -i input.mp4 -c copy output.mp4
</pre>


== Video Trimmer ==
== Video Trimmer ==
Line 36: Line 44:


== [https://www.shotcutapp.com/ Shotcut] ==
== [https://www.shotcutapp.com/ Shotcut] ==
It is a cross-platform open source software. See [https://www.pcworld.com/article/3240982/software/the-best-free-video-editing-software.html The best free video editing software: Great tools for YouTube stardom and more], [https://www.pcworld.com/article/2091349/the-best-open-source-tools-at-a-glance.html 22 awesome open source programs that do everything you need].
It is a cross-platform open source software. See  
* [https://www.pcworld.com/article/3240982/software/the-best-free-video-editing-software.html The best free video editing software: Great tools for YouTube stardom and more],
* [https://www.pcworld.com/article/2091349/the-best-open-source-tools-at-a-glance.html 22 awesome open source programs that do everything you need].
* [https://www.youtube.com/watch?v=6t5BQRQJIVY&t=1526s The Free and Open Source Software I Use in 2024 - Part 1]


I tested inserting a text in a video. Compared to Youtube video editor
I tested inserting a text in a video. Compared to Youtube video editor
* The text is really a text. No pop-up shape to select
* The text is really a text. No pop-up shape to select
* Not sure how to control the text so it only appears at a certain time interval
* Not sure how to control the text so it only appears at a certain time interval
Not as intuitive to use.


== [http://www.pitivi.org/ Pitivi] ==
== [http://www.pitivi.org/ Pitivi] ==
Line 198: Line 207:
* "Preset - Official - General - Fast 1080p30". Bit rate 3461 kbps. File size is 11.6MB
* "Preset - Official - General - Fast 1080p30". Bit rate 3461 kbps. File size is 11.6MB
* "Preset - Official - General - Very Fast 1080p30". Same dimension, code, frame rate but bit rate is half. Audio properties are the same. File size 6.2MB
* "Preset - Official - General - Very Fast 1080p30". Same dimension, code, frame rate but bit rate is half. Audio properties are the same. File size 6.2MB
== ffmpeg to compress ==
<ul>
<li>Example 1: This reduces my 5 min video recorded using VLC from 148M (MPEG-1/2) to 100MB (H264). All CPU cores will be used by ffmpeg. It took 2:30 minutes on i5-8259U. If I used "-c:v libx265", the file size is 94 MB and it took 5 minutes to convert.
{{Pre}}
ffmpeg -i input.mp4 -vf scale=-1:720 -c:v libx264 -crf 23 -preset medium -c:a 128k output.mp4
</pre>
* -vf scale=-1:720: Resize to have a max height of 720 pixels
* -c:v libx264: Encode the video using the H.264 codec. '''ffmpeg -encoders''' to list all encodec. [https://stackoverflow.com/a/20587693 What are all codecs and formats supported by FFmpeg?].
* -crf 23: Set the constant rate factor (CRF) for video quality. Lower values result in higher quality but larger file sizes. The default is 23.
* -preset medium: set the encoding preset. Options include ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, and placebo.
* -c:a aac -b:a 128k: Encode the audio using the AAC codec with a bitrate of 128kbps
</ul>


= Convert video to gifs =
= Convert video to gifs =

Revision as of 18:52, 29 April 2024

Video editing in Linux

DaVinci Resolve

LosslessCut: ffmpeg frontend

  • https://github.com/mifi/lossless-cut
  • Free Video Cutter LosslessCut Adds Multiple Cut Points, Video Merging Feature
  • Tested on Ubuntu 22.04 and it works perfectly. sudo snap install losslesscut
    1. Move the white segment for the play position and press the 'Play' button to start playing from there
    2. Click the left button for the Start position and the right button for the End position to create a segment
    3. Repeat the above process to create a second segment
    4. Choose "Merge cuts" from the dropdown list of the right most control above the video
    5. Click the "Export" button and review all the options there. Click the "Export" button again will save the file if you have only one segment. OR click "Export+merge" button to save the merged segments to a new file.
    6. The speed is fast
Losslesscut.png

ffmpeg for video trimmer

Cutting the videos based on start and end time using ffmpeg. It's very fast from my testing.

ffmpeg -ss 00:01:00 -to 00:02:00 -i input.mp4 -c copy output.mp4

Video Trimmer

Video Trimmer: A No-nonsense, Simple Video Trimming Application for Linux Desktop

Join two MKV files

Joining Two MKV files in Ubuntu? I use simpleScreenRecorder to create one mkv file. Then I want to append it so I record another short one. mkvmerge from mkvtoolnix works well.

Another suggestion that does not limit to mkv format is avidemux (cross platform).

Note MKV files are not supported by Chrome. To convert mkv files to mp4, use ffmpeg. ffmpeg -i dummy.mkv dummy.mp4 See How to Convert MKV to MP4 in Ubuntu Using FFmpeg. In my example, the mp4 format has a smaller file size compared to the mkv format.

Shotcut

It is a cross-platform open source software. See

I tested inserting a text in a video. Compared to Youtube video editor

  • The text is really a text. No pop-up shape to select
  • Not sure how to control the text so it only appears at a certain time interval

Pitivi

Blender

Looks very professional too. Windows/Linux/OSX (binary files are provided). Worth to try.

Kdenlive

The 5 Best YouTube Channels to Learn Kdenlive 2023/7

Flowblade

Free Linux Video Editor Flowblade 2.0 Released With Configurable Timeline Editing Workflow, New Tools

Youtube Video Editor

Good

  • Annotation and Title (Video Manager -> Videos -> Edit -> End screens and annotations -> Annotations -> Add annotations (Speech bubble, Note, Title, Spotlight, Label). However, the annotations do not show up on mobile. See this post for a discussion.
  • Add photos

Bad

  • Music cannot have fade in/out

Notes

Best Video Editing Apps and Software for YouTube

7 Things You Need to Build a Low-Cost YouTube Studio

http://www.makeuseof.com/tag/build-low-cost-youtube-studio/

Subtitle Generators Online

The 5 Best Free Auto Subtitle Generators Online

Free or Open source Subtitle editor

Comparison of subtitle editors

For TV captions, use white color font with black color for borders and transparent background.

OpenShot-qt

sudo apt-get install openshot

When I needed to export the video (choose 'youtube' profile, 'youtube-HD' target, 'HD 270, 29 .97 bps', and 'high' quality), I found I need to install libx264 code. On Ubuntu, I open software center and seach 'libavformat'. I choose 'libavformat-extra-53'.

An introduction to video editing in Openshot 2.0 from howtoforge.

Don't use the version (1.4.3 date 2009) because it crashed too often.

The new version 2.0.7 (date 2016) looks a little different (theme is black. Cool!). Its icon and command (openshot-qt) are different too. The project saved from 1.4.3 cannot be opened in 2.0.7. The tools icons are different: Add track, Snapping tool, Add Marker, Previous Marker, Next Marker, Zoom in/out.

This version of OpenShot + (old) Core2Duo Ubuntu = Dynamic Heatmap Viewer video.

Audio library

You can download free music from Youtube Audio Library. If you use a copy righted music and upload your video to youtube, the video will show Ad eventually.

Take a snapshot

The keyboard shortcut Ctrl+d does not work.

One suggestion is to use VLC. VLC -> Video -> Take Snapshot. The snapshot will be automatically created in ~/Pictures/ directory (*.png format).

Procedure

  1. Put audio and video files in one folder
  2. Use openshot to create a new video. Also
    • Use the +/- sign for zoom in and zoom out
    • Right click video file and select Volume -> Entire clip -> level 0%
    • Right click audio and select Volume -> End of clip -> fade out (slow)
  3. openshot -> Save (arrow/download-like button)
  4. openshot -> Export (red circle button)
    • Modify the file name so it won't overwrite the original (openshot won't check it)
    • Select Profile = Web, Target=Youtube-HD, Video Profile=HD 1080p 25 fps, Quality=High.
  5. Check the exported video (play it first by VLC).
    • On one instance the audio is fuzzy until the middle of the video. So I have to change the audio
    • On another instance the video length is longer than I expected because the final annotation slide lasts too long. A solution is to change the setting (Profile=All Formats, Target=MP4 (h.264), Video Profile=HD 1080p 24 or 23.98 fps). If I use 25 fps, the file will be wrong.
  6. Upload to Youtube. Use Youtube video editor to include annotation.

VideoLAN Movie Creator

ffdiaporama

Create videos from images, movie clips and music.

Flowblade Movie Editor

It is written in Python. Only Linux version is available (no Windows nor OS X). Good for beginners.

sudo apt-get install flowblade

Lightworks

Free and Pro versions are available. Windows/Linux/OSX.

Windows

How to Create Videos With the Windows 11 Photos App

Codec information

How to find out which Codec a video file is using

Video rip/convert/transcoder

sudo add-apt-repository ppa:stebbins/handbrake-releases
sudo apt-get update
sudo apt-get install handbrake-gtk

sudo apt-get install handbrake-cli

To merge audio and video

# naive: use the one with longer duration as the total length
avconv -i music.m4a -i input.mp4 -acodec aac -strict experimental output.mp4
# improved: specify the start time (-ss) and duration (-t)
# unfortunately the music at the specified end time may not be the end
# so a better way is to use a video editor (eg OpenShot) and specify fade out on the end of the audio!
avconv -i music.m4a -i input.mp4 -acodec aac -strict experimental -ss 00:00:00 -t 00:01:01 -codec copy output.mp4

To extract audio only:

avconv -i INPUT.flv -codec copy -vn OUTPUT.mp4

Handbrake to reduce file size

When I try to use handbrake to convert a video,

  • Original file: 25 seconds. Bit rate is N/A. 16.8MB.
  • "Preset - Official - General - Fast 1080p30". Bit rate 3461 kbps. File size is 11.6MB
  • "Preset - Official - General - Very Fast 1080p30". Same dimension, code, frame rate but bit rate is half. Audio properties are the same. File size 6.2MB

ffmpeg to compress

  • Example 1: This reduces my 5 min video recorded using VLC from 148M (MPEG-1/2) to 100MB (H264). All CPU cores will be used by ffmpeg. It took 2:30 minutes on i5-8259U. If I used "-c:v libx265", the file size is 94 MB and it took 5 minutes to convert.
    ffmpeg -i input.mp4 -vf scale=-1:720 -c:v libx264 -crf 23 -preset medium -c:a 128k output.mp4
    
    • -vf scale=-1:720: Resize to have a max height of 720 pixels
    • -c:v libx264: Encode the video using the H.264 codec. ffmpeg -encoders to list all encodec. What are all codecs and formats supported by FFmpeg?.
    • -crf 23: Set the constant rate factor (CRF) for video quality. Lower values result in higher quality but larger file sizes. The default is 23.
    • -preset medium: set the encoding preset. Options include ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, and placebo.
    • -c:a aac -b:a 128k: Encode the audio using the AAC codec with a bitrate of 128kbps

Convert video to gifs

PC build for video editing

Video Editing 4K PC Build: Creating Content for Under a Grand

Crop/cut videos

Object removal

Google map animation

How the sausage is made

Frame rate, bit rate

Video Bitrate Vs. Frame Rate

Tips to Make Home Videos Look Professional

10 Simple Tips to Make Home Videos Look Professional

Video conference apps

PowerPoint

GPU Acceleration

H.264

Advanced Video Coding

VP9

H.265

AV1

  • https://en.wikipedia.org/wiki/AV1
    • av1 is royalty free
  • AV1 is a new video codec that is designed to be more efficient than the current H.264 and H.265 codecs. If your computer doesn’t have AV1 decoding, it means you’ll use more bandwidth, or you’ll use more battery watching that super high-resolution video.
  • AV1 is intended to be the successor to the HEVC (H.265) format currently used for 4K HDR video on platforms such as Prime Video, Apple TV+, Disney Plus, and Netflix.
    • You may need to use AV1 to watch videos in situations where you want to stream high-quality video content with minimal data usage. For example, AV1 could be used for streaming movies, video chat, screen sharing, and video game streaming.
    • Google and Netflix also use AV1 to transmit videos in applications like YouTube and Google Duo to offer better quality on low bandwidth connections.
    • To watch AV1 content, you need both hardware and software support. This mostly depends on the device you have and the operating system it is using. For example, if you are using Windows 10, you can add AV1 codec support to your device by installing the AV1 Video Extension from the Microsoft Store.
  • List of CPU/SoC with AV1 support? CPU (with iGPU included) that can perform AV1 hardware decoding: Intel 11th generation and newer. AMD Ryzen 6000 or newer.
  • How to turn on AV1 settings on YouTube and why you should do it.
  • Tested: AV1 performance in 11th-gen Tiger Lake vs. 10th-gen Ice Lake and Comet Lake, Ryzen 4000

OBS

  • Basic use
    • I switch to X11 from Wayland in Desktop echo $XDG_SESSION_TYPE. PS, Wayland is supported but we need to select PipeWire for the "Screen Capture" or "Window Capture" sources. Also hotkeys do not work in a Wayland session.
    • Install obs-studio (unofficial) sudo snap install obs-studio. https://snapcraft.io/obs-studio. The version I am using is latest/stable 30.0.0. It will be available in /snap/bin/obs-studio.
    • Open OBS Studio by Launcher.
    • File - Settings - Output - Change "Recording Path". Change "Recording Format" if we want.
    • Choose "+" from Sources. Add Screen Capture (XSHM). Change the name if we want. OK
    • If we move mouse over the upper part of OBS, we shall we the whole desktop.
    • Click Controls - Start Recording.
    • Do anything we want on the desktop
    • Click Controls - Stop Recording.
    • "sudo apt install vlc"
    • "vlc ~/2023-XXXXX.mkv"
  • Tips
    • The snap version of OBS-STUDIO crashed a lot. "sudo snap remove obs-studio"
    • https://obsproject.com/kb/linux-installation. OBS Studio is officially distributed as a "Flatpak" on "Flathub" (not tested) and a PPA for Ubuntu 20.04 and newer.
    • For some reason, the snap version does not pop up the auto-configuration wizard. We can however click on Tools - Auto-Configuration Wizard to optimize OBS for streaming or recording.
    • Any key bindings? If we leave OBS in the background, it will be recorded too. By default, OBS hotkeys functionality is effectively disabled. Go to Settngs -> Hotkeys. I choose Start Recording: F9. Stop Recording: F10 (it works).
    • Note hotkeys do not work in Wayland or keyboard shortcuts do not work on Wayland outside the active window. That is, the hotkeys only work if the focus is OBS Studio.
    • Base resolution (display you want to capture) vs Output resolution. Getting your video settings right in OBS. To change the output resolution, Settings - Video - Output (Scaled) Resolution.
    • Screen Capture (PipeWire), Screen Capture (XSHM), Window Capture (PireWire), Window Capture (xcomposite). Display Capture Sources. PipeWire requires Wayland. Screen Capture (XSHM) works fine on Ubuntu 22.04 with Xorg/X11.
    • Screen Recording in Linux With OBS and Wayland.
  • Conclusions
    • Install OBS Studio in the Ubuntu 22.04 GNOME using PPA
    sudo add-apt-repository ppa:obsproject/obs-studio
    sudo apt install obs-studio
    • Login a desktop environment. Using the X11 mode, rather than the Wayland mode
    • PipeWire works on both Wayland X11. But we can choose XSHM too in X11.
    • Change Output directory (eg ~/), Output Video Resolution (eg 1024 x 768), Hotkeys (eg F9 for start recording, F10 for stop recording) in Settings.
    • Add source. Either Screen Capture or Window Capture.
    • Start recording.

影評