• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Archives for October 2019

Excel Delete Blank Rows

October 31, 2019

Here’s how to delete blank rows in Excel.

Filed Under: Misc Tagged With: blank, delete, excel, rows

Bash History With Timestamps

October 31, 2019

If you need to see Bash history with timestamps, use this command.

HISTTIMEFORMAT="%d/%m/%y %T "

HISTTIMEFORMAT="%d/%m/%y %T "

To make it permanent, add it to your .bashrc.

echo 'HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc
source ~/.bashrc

echo 'HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc source ~/.bashrc

Timestamps accuracy is retroactively, meaning it will not be accurate for commands performed prior to the history time format being set.

Filed Under: Linux Tagged With: bash, bashrc, history, timestamps

Tar Commands

October 30, 2019

Here are two important tar commands on how to create and extract a tar.gz file.

Create a tar gzip file called “project.tar.gz” of a directory called “foo.”

tar -cvzf project.tar.gz foo

tar -cvzf project.tar.gz foo

Untar the “project.tar.gz” file to a directory called bar.

tar -xvzf project.tar.gz bar

tar -xvzf project.tar.gz bar

Filed Under: Linux Tagged With: create, directory, gzip, tar, untar

FFMPEG with Start Time

October 29, 2019

This is a follow up to a previous post about FFMPEG. In addition to sending a RTMP stream, you can also set a start time and duration.

Here’s how to set the start time using -ss option and -to for the duration. Video will start at 1 min 23 secs and play until 2 mins.

ffmpeg -ss 00:01:23 -i video.mp4 -to 00:02:00 -c copy -copyts cut.mp4

ffmpeg -ss 00:01:23 -i video.mp4 -to 00:02:00 -c copy -copyts cut.mp4

Here’s how to start time to start the video at 1 min 23 sec for RTMP streaming. Please note, the start time option needs to be before the input file.

ffmpeg -ss 00:01:23 \
-re -i $1 -acodec libmp3lame -ar 44100 -b:a 128k \
-pix_fmt yuv420p -profile:v baseline -s 1280x720 -bufsize 6000k \
-vb 1200k -maxrate 1500k -deinterlace -vcodec libx264           \
-preset veryfast -g 30 -r 30 -f flv                            \
-flvflags no_duration_filesize                                 \
"rtmp://username:password@yourserver:1935/live/backup"

ffmpeg -ss 00:01:23 \ -re -i $1 -acodec libmp3lame -ar 44100 -b:a 128k \ -pix_fmt yuv420p -profile:v baseline -s 1280x720 -bufsize 6000k \ -vb 1200k -maxrate 1500k -deinterlace -vcodec libx264 \ -preset veryfast -g 30 -r 30 -f flv \ -flvflags no_duration_filesize \ "rtmp://username:password@yourserver:1935/live/backup"

Filed Under: Cloud, Linux Tagged With: ffmpeg, rtmp, start time

RTMP of MP4 via FFMPEG

October 27, 2019

FFMPEG is the jack of all trades utility for both audio and video files. You can record, convert, and even live stream an audio or video file in just about any file format. In this example, I will be sending a RTMP stream of a MP4 file to a Wowza streaming server. I can easily send the same stream to YouTube, Facebook or any streaming server that accepts a RTMP source. In this example, I created simple Bash script called play.sh, with all the options needed to live stream to Wowza Streaming server.

Here are the options in play.sh.

ffmpeg -re -i $1 -acodec libmp3lame -ar 44100 -b:a 128k \
-pix_fmt yuv420p -profile:v baseline -s 1280x720 -bufsize 6000k \
-vb 1200k -maxrate 1500k -deinterlace -vcodec libx264           \
-preset veryfast -g 30 -r 30 -f flv                            \
-flvflags no_duration_filesize                                 \
"rtmp://username:password@yourserver:1935/live/backup"

ffmpeg -re -i $1 -acodec libmp3lame -ar 44100 -b:a 128k \ -pix_fmt yuv420p -profile:v baseline -s 1280x720 -bufsize 6000k \ -vb 1200k -maxrate 1500k -deinterlace -vcodec libx264 \ -preset veryfast -g 30 -r 30 -f flv \ -flvflags no_duration_filesize \ "rtmp://username:password@yourserver:1935/live/backup"

To launch, run the script.

bash play.sh filename.mp4

bash play.sh filename.mp4

Filed Under: Linux Tagged With: ffmpeg, flv, livestream, mp4, rtmp, wowza

RFC 1918

October 24, 2019

Here’s the original document published back in February 1996 detailing the allocation for private internet addresses. The Internet Assigned Numbers Authority (IANA) has reserved the following three blocks of the IP address space for private internets. RFC 1918.

10.0.0.0        -   10.255.255.255  (10/8 prefix)
172.16.0.0      -   172.31.255.255  (172.16/12 prefix)
192.168.0.0     -   192.168.255.255 (192.168/16 prefix)

10.0.0.0 - 10.255.255.255 (10/8 prefix) 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)

Filed Under: Misc Tagged With: addresses, internet, private, rfc 1918

XFS Filesystem has duplicate UUID

October 7, 2019

Here’s how to fix a duplicate UUID on a XFS file system.

mount -o rw,nouuid /dev/sda1  /data

mount -o rw,nouuid /dev/sda1 /data

Mounting with nouuid will work, but not after a reboot.

To avoid a duplicate ID, run this command to generate a new UUID.

xfs_admin -U generate /dev/sda3
Clearing log and setting UUID
writing all SBs
new UUID = xxxxx-xxxx-xxxx-xxxxxxxxx

xfs_admin -U generate /dev/sda3 Clearing log and setting UUID writing all SBs new UUID = xxxxx-xxxx-xxxx-xxxxxxxxx

Filed Under: Linux Tagged With: duplicate, generate, mount, uuid, xfs

Yum RPMDB failed

October 4, 2019

If you are getting an error similar to the yum error below, yum may be broken in your system.

error: rpmdb: BDB0113 Thread/process 2196/139984719730496 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 - (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
 
Error: rpmdb open failed

error: rpmdb: BDB0113 Thread/process 2196/139984719730496 failed: BDB1507 Thread died in Berkeley DB library error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db5 - (-30973) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum.main: Error: rpmdb open failed

Here’s the fix.

mv /var/lib/rpm/__db* /tmp
yum clean all

mv /var/lib/rpm/__db* /tmp yum clean all

Run your yum commands. The errors should be gone.

Filed Under: Linux Tagged With: database, error, failed, rpm, yum

  • Go to page 1
  • Go to page 2
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2023