• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

video

FFMPEG Resize

October 25, 2022

How to resize JPEG using FFMPEG.

ffmpeg -i TREE.JPG -y -vf scale=iw*.2:ih*.2 tree.jpg

ffmpeg -i TREE.JPG -y -vf scale=iw*.2:ih*.2 tree.jpg

Another option is to set resolution.

ffmpeg -i TREE.JPG -y -vf scale=-1:720 tree.jpg

ffmpeg -i TREE.JPG -y -vf scale=-1:720 tree.jpg

How to resize video using FFMPEG.

ffmpeg -i TREE.MP4 -s 640x360 -pix_fmt yuv420p -crf 18 tree.mp4

ffmpeg -i TREE.MP4 -s 640x360 -pix_fmt yuv420p -crf 18 tree.mp4

How to create a thumbnail from a video.

ffmpeg -ss 00:00:00 -i tree.mp4 -vframes 1 tree.jpg

ffmpeg -ss 00:00:00 -i tree.mp4 -vframes 1 tree.jpg

Filed Under: Linux Tagged With: create, ffmpeg, image, resize, thumbnail, video

FFMPEG Offset Audio

June 19, 2020

If your audio is out of sync, you can fix using ffmpeg.

ffmpeg -i source.mp4 \
-i livestream.mp4 \
-map 0:0 -map 1:1 \
-acodec copy \
-vcodec copy \
-itsoffset 0.100 \
output.mp4

ffmpeg -i source.mp4 \ -i livestream.mp4 \ -map 0:0 -map 1:1 \ -acodec copy \ -vcodec copy \ -itsoffset 0.100 \ output.mp4

The ffmpeg fix is fast. A 1GB file took less than 30 seconds to run. Adjust -tsoffset until you find the sweet spot.

Filed Under: Linux Tagged With: audio, ffmpeg, offset, sync, video

Video Conferencing

April 12, 2020

Due to the Covid-19 lockdown, here are several video conferencing options.

  • Microsoft Skype – been around for a long time.
  • Microsoft Teams – Microsoft wants everyone to switch to Teams.
  • Google Meet – Uses the webRTC protocol. Video calls up to 10 people.
  • Discord – Popular with gamers. Video chat capable up to 9 people.
  • Zoom – Got really hot, then took a dive due to zoombombing.
  • Chime – Amazon Web Services video chat.
  • Webex – Cisco’s video conferencing.

This is not an extensive list, but are the popular options.

Believe it or not, I have all on my work laptop except for Discord.

Filed Under: Cloud Tagged With: chat, chime, discord, meet, skype, teams, video, voice, webex, zoom

FFMPEG Convert TS to MP4

December 4, 2019

If you have video files that are formatted in MPEG-2, video files with a .m2ts extension, you can convert them to MP4 using ffmpeg.

ffmpeg -i input.ts -c:v libx264 -c:a aac output.mp4

ffmpeg -i input.ts -c:v libx264 -c:a aac output.mp4

The video is encoded using open format H.264, while audio is encoded using AAC.

Filed Under: Linux, Misc Tagged With: .m2ts, convert, ffmpeg, files, mp4, video

Python: 16:9 Aspect Ratio

November 15, 2018

Just playing around with Python. This program a simple calculation of a video’s 16:9 aspect ratio.

Just supply the width or height in pixels, it will display the 16:9 resolution.

Here’s the code.

import math
 
print("===================================================")
print("This program will calculate a video's aspect ratio.")
print("===================================================")
 
height_or_width = input('Choose a height or width (h, w) to calculate? ')
 
if height_or_width == "h":
	video_height = float(input("Enter a video height in px: "))
	video_width = video_height * 1.7777777777777
	print("")
	print("The video aspect ratio is: {:.0f} x {:.0f}".format(video_width, video_height))
	print("")
 
elif height_or_width == "w":
	video_width = float(input("Enter a video width in px: "))
	video_height = video_width / 1.7777777777777
	print("")
	print("The video aspect ratio is: {:.0f} x {:.0f}".format(video_width, video_height))
	print("")
 
else:
	print('Thanks for playing .... ')
	print('')

import math print("===================================================") print("This program will calculate a video's aspect ratio.") print("===================================================") height_or_width = input('Choose a height or width (h, w) to calculate? ') if height_or_width == "h": video_height = float(input("Enter a video height in px: ")) video_width = video_height * 1.7777777777777 print("") print("The video aspect ratio is: {:.0f} x {:.0f}".format(video_width, video_height)) print("") elif height_or_width == "w": video_width = float(input("Enter a video width in px: ")) video_height = video_width / 1.7777777777777 print("") print("The video aspect ratio is: {:.0f} x {:.0f}".format(video_width, video_height)) print("") else: print('Thanks for playing .... ') print('')

The output:

Filed Under: Linux Tagged With: aspect ratio, python, video

Optimize Your Videos For The Web

November 6, 2016

If you have a video that you would like to share with others, how do you optimize it for the web. I’m using a simple open-source program called Handbrake which you can download for free. It’s available from handbrake.fr. Handbrake is available on Windows, Mac and Linux. Based on my experience with working with Handbrake, I was able to shrink my videos to less than 10% of the original size without sacrificing quality.

Here’s a short video of how to optimize your videos for the web using Handbrake.

Video

Filed Under: Misc Tagged With: encoding, handbrake, optimize, video

  • Home
  • About
  • Archives

Copyright © 2023