Solution to Problematic Audio because of Pulseaudio

Solution to Problematic Audio because of Pulseaudio


Symptoms of Problematic Pulseaudio due to permission problem:

- Some or all audio doesn't work, youtube and other flash videos affected, may not play or may play but without audio whether embedded in a website or not

- Cannot restart pulseaudio with:

$ pulseaudio -D
/or
$ pulseaudio --start

as regular or super user, however pulseaudio should work and preferably on normal user, but the user
must be in the audio group

- Pulseaudio command output:

E: [pulseaudio] main.c: Daemon startup failed.

or

E: [pulseaudio] main.c: Daemon startup failed.
E: [pulseaudio] main.c: pa_pid_file_create() failed

or something similar but fails to start the pulseaudio daemon


Solution:

Delete the .config/pulse/ directory
Restart or reboot system
Pulseaudio will now start as regular user

at terminal:

$ cd ~
$ cd .config
$ rm -rf pulse/

Restart computer, everything should work.
A new pulse directory would have been automatically created in .config/ directory


Troubleshooting:

- If you prefer to not use pulseaudio you can just uninstall pulse and reinstall alsa to be sure
- If you prefer to use pulseaudio, you can also try to reinstall pulseaudio and alsa
- If those options above don't work, you can also try deleting asound.conf do: # rm -rf /etc/asound.conf
- Check alsamixer, to make sure the problem is not because of a setting that is just muted or misconfigured
   in terminal do: $ alsamixer
   anything labeled MM means its muted, toggle to enable/disable by highlighting them then press M
   press escape to exit, if the settings do not stay persistent, re-do the settings and then after exiting, in
   terminal do: # alsactl store
- If alsamixer is always mute on reboot despite doing the "# alsactl store" command, then just
  disable the module "module-device-restore" by editing the file /etc/pulse/default.pa, save, exit and reboot.



*Notes:

- Make sure your user is in audio group
- Tested working on Arch Linux

How to Embed Subtitles to a Video in Linux

How to Embed Subtitles to a Video in Linux


1.) ffmpeg:

$ ffmpeg -i /path-to/videoFoo.avi -vf subtitles=/path-to/subtitleFoo.srt /path-to/output_videoFoo.avi


/or


2.) mencoder:

$ mencoder video.avi -oac copy -ovc lavc -sub /path-to/subtitleFoo.srt -subfont-text-scale 3 -o output_videoFoo.avi





Extract and Convert wmv Files to mp3 Files in Linux

Extract and Convert wmv Files to mp3 Files in Linux


Input at command line:

$ ffmpeg -i file.wmv -vn new.mp3


Notes:
- It actually works for many types of video files as well
- You can remove the -vn option and use it on different kinds of audio files to convert to mp3 files

Merge mp4 Files in Linux

Merge mp4 Files in Linux

One of the best ways to prevent losing quality from concatenating files is to transcode them to mpeg transport streams, using  H.264 video and AAC audio -

$ ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts new1.ts

$ ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts new2.ts

then

$ ffmpeg -i "concat:new1.ts|new2.ts" -c copy -bsf:a aac_adtstoasc output.mp4


Notes:
- In this example I use only 2 mp4 files converted to streams and then concatenating them, but you can
put as much as you like that your system can handle

How to Install Linux into a USB Flash Drive

How to Install Linux into a USB Flash Drive:


My preferred way is to disk dump the linux iso contents to the drive by command line, but there are other automated ways to do it and with GUI, such as UnetbootinLinux Live USB or if your using windows to make the linux live usb drive, I recommend Rufus or Win32DiskImager for (32 bit windows only) For those you can just start the program and follow the instructions, its quite easy, or you can install and use cygwin where you can use GNU/Linux tools like dd in windows.

To find out which device your flash drive is, you can use many ways I'll just mention 2 here, either use fdisk or lsblk at command line:

# fdisk -l
/or
$ lsblk

After determining which is your device

Issue the command, with a pseudo foo path to the file.iso, assuming the flash drive is in /dev/sdb for example

# dd if=/path-to/file.iso of=/dev/sdb bs=4M; sync  
/or

# dd if=/path-to/file.iso of=/dev/sdb bs=4M status=progress oflag=nocache,sync && sync

To make sure the process completes successfully, unmount the flash drive, before unplugging:

# umount /dev/sdb

How to Download a Remote Directory Recursively with wget

How to Download a Remote Directory Recursively with wget

How to Download Folders and Files Recursively within a Remote Directory with wget, Issue command:

$ wget -e robots=off --cut-dirs=3 --reject="index.html*" --no-parent --recursive --relative --level=1 --no-directories "https://url-here/path-to-folder"



Download Flash Videos from Video Streaming Sites like youtube with Linux Command Line Apps

Download Flash Videos from Video Streaming Sites like youtube with Linux Command Line Apps


1.) with youtube-dl:

$ youtube-dl -cit "youtube.com/url-here" 

- optional to download an entire playlist or channel, go to the desired playlist list or channel, and grab the url then paste in terminal:

$ youtube-dl -cit "youtube.com/playlist_url-here"

- optional to download a custom list of video files, create a plain text/txt file and place all the YouTube links that you wish to download there, for example yt_foo_list.txt

$ youtube-dl -a yt_foo_list.txt

- optional to download the sound/music of the video to mp3 only:

$ youtube-dl -cit --extract-audio --audio-format mp3 "youtube.com/url-here"

- optional to download a video in certain file type/resoluton format, use option "–list-formats" with the command

$ youtube-dl –list-formats "youtube.com/url-here" 

- it will show you a list of formats with a corresponding video/resolution format code, that you can download in, choose from them, then to download a preferred file format from the list, use the option "-f", if flv was in the list and you want to save the file in that format, you then issue command

$ youtube-dl -f 34 "youtube.com/url-here"

- where 34 is the video/resolution format code of flv, it will say in the available video formats list or the resolutions available of the same format, code will be mentioned at the left most side

- optional to download video in all available formats, issue command

 $ youtube-dl –all-formats "youtube.com/url-here" 


2.) with get-flash-videos:

$ get-flash-videos "youtube.com/url-here"


3.) with cclive:

$ cclive "youtube.com/url-here"


4.) with movgrab:

$ movgrab "youtube.com/url-here"

5.) with you-get

$ you-get "youtube.com/url-here"

- Display the information of a video without downloading:

$ you-get "youtube.com/url-here"

- Download multiple videos:

$ you-get "youtube.com/url-here/A" "youtube.com/url-here/B"

-  Force Re-download vidoes (This will overwrite any existing video or temporary file):
 
$ you-get -f "youtube.com/url-here/"

- Set the output directory for downloaded files:

$ you-get -o ~/Downloads you-get -f "youtube.com/url-here/"

- Use a specific HTTP Proxy for Downloading
(use this -y proxy.uku.im:8888 as option and proxy for downloading from youku.com):

$ you-get -x 127.0.0.1:8087 "youtube.com/url-here/"

- Disable any proxy use  --no-proxy:

$ you-get --no-proxy "youtube.com/url-here/"

- Watch a video in your own video players of choice, like vlc and mplayer, to avoid uneccessary Ads.

$ you-get -p vlc "youtube.com/url-here/"

/or

$ you-get -p mplayer "youtube.com/url-here/"


Notes:
- To use any of the mentioned apps, they must be installed first
- youtube-dl, get-flash-videos, cclive, movgrab and you-get work in other sites as well not just youtube, for instance youtube-dl actually supports video download from several other sites like Dailymotion, Google Video, Photobucket, Facebook, Yahoo, Metacafe, Depositfiles and few more similar sites
- To upgrade youtube-dl do: $ youtube-dl -U
- youtube-dl can download from chinese websites like youku.com, tudou.com but if it doesnt work try to upgrade it first, if it doesn't work, you can use the you-get console app instead which supports alot of websites including chinese websites and even including japanese websites like niconico