Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, December 11, 2023

Add audio track to mp4

 

 

ffmpeg -i badges-of-fury-2013-watch-hd-freedownloadvideo.net.mp4 -i badges-of-fury-2013-watch-hd-freedownloadvideo.net
.mp3 -map 0 -map 1 -codec copy output_video.mp4   

ffmpeg -i badges-of-fury-2013-watch-hd-freedownloadvideo.net.mp4 -itsoffset 00:00:24 -i badges-of-fury-2013-watch-hd-f
reedownloadvideo.net.mp3 -map 0 -map 1 -codec copy badges_output_video.mp4


References:

[1] https://stackoverflow.com/questions/11779490/how-to-add-a-new-audio-not-mixing-into-a-video-using-ffmpeg

[2] https://superuser.com/questions/708125/add-audio-at-specific-time-in-video-using-ffmpeg

[3] Extract mp3 from youtube https://tuberipper.com

[4] Download mp4 from dailymotion https://freedownloadvideo.net

Sunday, November 12, 2023

Arcade Games Linux

 

Snes9x

sudo apt install flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub com.snes9x.Snes9x 

ZSNES is a Super Nintendo Emulator that can run on Windows, Linux, FreeBSD, and DOS. It runs as a GUI interface where you can load ROM of NES games.

sudo apt install zsnes
higan is an emulator for Nintendos SNES, NES, Gameboy, Gameboy Color, and Gameboy Advance. It was formerly called bsnes and the SNES emulation is especially complete and polished.
sudo apt install higan 

 

References:

https://www.debugpoint.com/3-nes-emulators-to-play-old-nes-games-in-linux/

 

Saturday, September 23, 2023

Update Gimp

From 2.8 to 2.10 using apt-get

$ sudo add-apt-repository ppa:otto-kesselgulasch/gimp

$ sudo apt-get update

$ sudo apt-get install gimp

 

References:

https://linuxhint.com/install_gimp_210_ubuntu_1804/

Friday, June 02, 2023

Tuesday, February 28, 2023

ffmpeg: Extract audio and reinsert a new for use in whatsapp

 

#Extract audio

ffmpeg -i mad-pi.mp4 -map 0:a:0 mad-pi_audio.wav 

 

#Extract reinsert new audio

ffmpeg -i mad-pi.mp4 -i mad-pi_audiohd.mp3 -c:v copy -map 0:v:0 -map 1:a:0 new.mp4
 

#reencode for whatsapp

ffmpeg -i new.mp4 -c:v libx264 -profile:v baseline -level 3.0 -pix_fmt yuv420p working.mp4

 

Monday, December 12, 2022

Ubuntu NFS Installation

On Server (10.10.7.229):

$ sudo apt install nfs-kernel-server  #install server

$ sudo mkdir -p /mnt/nfs_drive  #create share point

$ sudo chown -R nobody:nogroup /mnt/nfs_drive  #no owner

$ sudo chmod 777 /mnt/nfs_drive  #set r/w permission

$ sudo vi /etc/exports  #define clients grants
 

/mnt/nfs_drive 10.10.7.218(rw,sync,no_subtree_check) #mine
/mnt/nfs_drive 10.10.7.235(rw,sync,no_subtree_check) #houdini

$ sudo exportfs -a

$ sudo systemctl restart nfs-kernel-server
 

On Client: 

$ sudo apt install nfs-common 

$ sudo mkdir -p /mnt/nfs_drive_client   #mirror

$ sudo mount 10.10.7.229:/mnt/nfs_drive /mnt/nfs_drive_client

Notes: 

$ sudo ufw status  #verify the firewall, more details in reference[0]


References: 

[0] Working https://linuxhint.com/install-and-configure-nfs-server-ubuntu-22-04/

[1] https://www.tecmint.com/install-nfs-server-on-ubuntu/

Monday, March 14, 2022

Convert webp to png

 

Any file to PNG

$ sudo apt install webp
$ for i in *.webp; do name=`echo "$i" | cut -d'.' -f1`; echo "$name"; dwebp "$i"
-o "${name}.png"; done

Add to Nautilus Script
fincahuanaco@pisces:~/.local/share/nautilus/scripts$ cat toPNG   
dwebp $1 -o "$1.png"
rm $1

$chmod +x toPNG 
 
Updated to Selection to PNG (2023)
#!/bin/bash
count=0
success=0

# Transform command line arguments (if provided)
[[ -z "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]] &&
NAUTILUS_SCRIPT_SELECTED_FILE_PATHS=$(printf "%s\n" "$@")

# Process each file in turn
while IFS= read -r src
do
if [[ -f "$src" ]]
then
# Target
dst="${src}.png"

# Primary conversion to PNG
step=0

dwebp $src -o $dst && ((step++))

# Remove src
if [[ step -eq 1 ]]
then
rm $src && ((step++))
fi

# Update
if [[ step -eq 2 ]]
then
((success++))
fi

# Count it
((count++))
fi

done <<<"$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"

[[ count -gt 1 ]] &&
notify-send "Conversion finished ($success files of $count)"

exit $((count - success)) 
 
AVIF format support
[1] libavif https://github.com/AOMediaCodec/libavif/ 
 
References:

[1] https://unix.stackexchange.com/questions/710013/making-a-bash-script-apply-to-only-selected-files-nautilus 








Saturday, March 12, 2022

Linux Libraries path

#Cuda 8.0 Settings
export CUDA_HOME=/usr/local/cuda-8.0
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64  
PATH=${CUDA_HOME}/bin:${PATH}


#Cuda 9.1 Settings
export CUDA_HOME=/usr/local/cuda-9.1
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64  
PATH=${CUDA_HOME}/bin:${PATH}


#Cuda 9.2 Settings
export CUDA_HOME=/usr/local/cuda-9.2
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64  
PATH=${CUDA_HOME}/bin:${PATH}

 

$ LD_LIBRARY_PATH=. ./programtest  #direct execution
 

$ echo $LD_LIBRARY_PATH  
/usr/local/cuda-8.0/lib64
 

$ ls /etc/ld.so.conf.d
cuda-8-0.conf                   opencv.conf
fakeroot-x86_64-linux-gnu.conf  x86_64-linux-gnu.conf
glew.conf                       x86_64-linux-gnu_EGL.conf
i386-linux-gnu.conf             x86_64-linux-gnu_GL.conf
libc.conf                       zz_i386-biarch-compat.conf

$ldconfig -p  #list libraries

$sudo ldconfig #update paths

 

 


 

Saturday, October 16, 2021

Linux Touchpad issues

 

xinput list

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Dell Dell Universal Receiver              id=11   [slave  pointer  (2)]
⎜   ↳ AlpsPS/2 ALPS DualPoint TouchPad          id=16   [slave  pointer  (2)]
⎜   ↳ AlpsPS/2 ALPS DualPoint Stick             id=15   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
   ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
   ↳ Power Button                              id=6    [slave  keyboard (3)]
   ↳ Video Bus                                 id=7    [slave  keyboard (3)]
   ↳ Power Button                              id=8    [slave  keyboard (3)]
   ↳ Sleep Button                              id=9    [slave  keyboard (3)]
   ↳ Dell Dell Universal Receiver              id=10   [slave  keyboard (3)]
   ↳ Laptop_Integrated_Webcam_HD: In           id=12   [slave  keyboard (3)]
   ↳ Dell WMI hotkeys                          id=13   [slave  keyboard (3)]
   ↳ AT Translated Set 2 keyboard              id=14   [slave  keyboard (3)]
   ↳ Dell Dell Universal Receiver              id=17   [slave  keyboard (3)]

xinput -list-props 16

 
Device 'AlpsPS/2 ALPS DualPoint TouchPad':
       Device Enabled (142):   1
       Coordinate Transformation Matrix (144): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
       Device Accel Profile (275):     0
       Device Accel Constant Deceleration (276):       1.000000
       Device Accel Adaptive Deceleration (277):       1.000000
       Device Accel Velocity Scaling (278):    5.000000
       Trackpad Disable Input (305):   0
       Trackpad Sensitivity (306):     0.500000
       Trackpad Touch Pressure (307):  5, 5
       Trackpad Button Settings (308): 1, 1
       Trackpad Button Emulation Settings (309):       0, 1, 100
       Trackpad Button Emulation Values (310): 3, 2, 0
       Trackpad Tap Settings (311):    50, 120, 400
       Trackpad Tap Button Emulation (312):    1, 3, 2, 0
       Trackpad Thumb Detection (313): 0, 0
       Trackpad Thumb Size (314):      25, 70
       Trackpad Palm Detection (315):  0, 0
       Trackpad Palm Size (316):       40
       Trackpad Gesture Settings (317):        10, 100
       Trackpad Scroll Distance (318): 150
       Trackpad Scroll Buttons (319):  4, 5, 6, 7
       Trackpad Swipe Distance (320):  700
       Trackpad Swipe Buttons (321):   8, 9, 10, 11
       Trackpad Swipe4 Distance (322): 700
       Trackpad Swipe4 Buttons (323):  0, 0, 0, 0
       Trackpad Scale Distance (324):  150
       Trackpad Scale Buttons (325):   14, 15
       Trackpad Rotate Distance (326): 150
       Trackpad Drag Settings (327):   1, 350, 40, 200
       Trackpad Axis Inversion (328):  0, 0


xinput -set-prop 16 306 0.5

 

Thursday, July 01, 2021

Images to PDF file (case study)

0. Previous requeriments

$sudo apt install img2pdf
$sudo apt install ocrmypdf

1. Download images by script

for n in `seq 1 23`
do
  sn=`printf "%02d" $n`
  echo $sn
  wget https://larepublica.cronosmedia.glr.pe/printed/2021/07/01/lima/pages/$sn.jpeg
done
 

2. Convert images to pdf (after executed download script by sh)

$img2pdf *.jpeg --output rep1.pdf #or

$convert *.jpeg rep2.pdf

$ocrmypdf rep1.pdf rep1_ocr.pdf #reduce size

 

Notes for convert command(change from none to read|write):

sudo vim /etc/ImageMagick-6/policy.xml

<policy domain="coder" rights="none" pattern="PDF" />

<policy domain="coder" rights="read|write" pattern="PDF" />
 
 
Bonus
[1] El Pueblo news url https://www.diarioelpueblo.com.pe/wp-content/uploads/2021/07/01-07-2021.pdf
 

Friday, March 12, 2021

Ubuntu users tools

 

To hidden (no initial list at login)

sudo vi /var/lib/AccountsService/users/cloud

SystemAccount=true #change this from false to true

References:

[1] add user https://linoxide.com/usr-mgmt/give-normal-user-root-privileges/

[2] hidden user https://swatij.me/hacks/ubuntu/hide-user-from-login-screen-in-ubuntu-14-04.html

Wednesday, March 10, 2021

Ubuntu enable Sony Xperia USB transfer

 

sudo apt-get install libusb-dev

sudo apt-get install gmtp

References:

[1] Manual installation of libmtp http://www.humans-enabled.com/2011/12/how-to-fix-samsung-galaxy-nexus-mtp.html

[2] https://gmtp.sourceforge.io/

[3] Original post https://android.stackexchange.com/questions/36376/cant-explore-files-on-my-sony-xperia-u-using-my-ubuntu-12-10-laptop

Friday, October 30, 2020

Compile k3d in Ubuntu 16

 

Logo

Source http://www.k-3d.org/

Main errors:

INCLUDE(K3DFindFreetype2) # freetype6-dev

INCLUDE(K3DFindGtkmm) #DEBUG 

https://gtkmm.org/en/download.html #works with version 2.x

INCLUDE(K3DFindFTGL) #DEBUG

#To DEBUG Variables

message(STATUS "DEBUG: K3D_FREETYPE2_FOUND: ${K3D_FREETYPE2_FOUND}")
message(STATUS "DEBUG: Aqsis_FOUND: ${Aqsis_FOUND}")

#Support CUDA need to enable in CMakeLists.txt (main)

Day 2:

K3DFindBoost.cmake (update paths)

SET(K3D_BOOST_INCLUDE_DIR "/usr/local/include" CACHE PATH "Override the default location for Boost header files.")
SET(K3D_BOOST_LIBRARY_DIR "/usr/local/lib" CACHE PATH "Override the default location for Boost libraries.")


renderframe/CMakeLists.txt

LINK_DIRECTORIES() #add boost path

TARGET_LINK_LIBRARIES()  #add boost_regex boost_program_options boost_system boost_python27 boost_thread boost_date_time

 #disable CGAL

#K3D_CHECK(K3D_BUILD_CGAL_MODULE REQUIRES K3D_CGAL_FOUND RESOURCE "CGAL") #DEBUG


 

Saturday, October 24, 2020

Compile and Links snippets

 

 

[1] cmake parameters https://stackoverflow.com/questions/31387188/pass-variable-value-to-make-using-cmake

 

[2] PYTHONPATH https://www.devdungeon.com/content/python-import-syspath-and-pythonpath-tutorial

 

Wednesday, October 21, 2020

Boost 1.7 on Ubuntu16

 

 

https://www.boost.org/users/download/


Enable to work with Python3


cd boost1.7
 $./bootstrap.sh -with-libraries=python -with-python-version=3.6 
$./b2
$sudo ./b2 install

Monday, March 09, 2020

cmake force g++ gcc version to use



$cmake -DCMAKE_CXX_COMPILER=g++-8  -DCMAKE_CC_COMPILER=gcc-8 ..

This command affec to next variables into CMakeLists.txt file
CMAKE_CXX_COMPILER_VERSION
CMAKE_CXX_COMPILER_ID


#Next lines doesn't works for me on this time.

set(CMAKE_C_COMPILER /usr/bin/gcc-8)
set(CMAKE_CXX_COMPILER /usr/bin/g++-8)

Thursday, November 21, 2019

Linux System Information



Find if your Linux is 64 bit is by using:

$getconf LONG_BIT

`uname -m` tells only about the kernel, the userspace and distro can be still 32-bit. Similarly `lscpu` only tells what the CPU is capable of, not if OS, kernel and distro are 32 or 64 bit.
 
 
$file /lib/systemd/systemd
$lscpu
$uname -i
$uname -m 
$dpkg --print-architecture
 

Firefox open multiple private window

    /opt/firefox/firefox-bin --profile $(mktemp -d) --private-window www.google.com www.bing.com