Encoding for youtube

I can never seem to get it right. These two links offer some respite:

Ffmpeg Wiki

Re-encode the video and stream copy the audio. The output should be a similar quality as the input and will hopefully be a more manageable size.

Same as above, but also re-encode the audio instead of stream copying it:

Create a video with a still image (input.png) and an audio file (audio.ogg):

Jernej Virag

Xubuntu Bluetooth – blueman – automatic device connection (audio+headset)

bluemanThis had me flummoxed for a while, if I wanted my HTC ONE-X or Jabra Clipper to connect to the PC, I always had to go into devices and then select audio sink before it would connect, this is having previously paired and trusted the devices.

A foray into /etc/bluetooth/ showed all the .conf files for bluetooth, including audio.conf.

In there is a setting for auto-connection. All you have to do is remove the comment from the last line of the coda, save out then restart bluetooth, and your devices should automagically connect next time you try

 

This is going to be of great help when using bluetooth headphones on our htpc, and also with my carpc for either connecting the phone to the car, or for other bluetooth uses (yet to be discovered but keyboard or remote possibilities)

Rough Guide to Bitrate Calulations for Video Encoding

Want a video to be a particular size?

((Size (mb) x 8192) / length of video (secs)) – audio bitrate (k) = video bitrate required

Example in bash with file size of 13.79mb, audio bitrate of 128k and length of 180 seconds:

What to know the size of a video when using a particular bitrate?

((Video bitrate (k) + Audio bitrate (k))  x length (secs)) / 8192 = Size (mb)

Example in bash, with video bitrate of 500, Audio bitrate of 128, length of video 180 seconds:

You can put these into a variable:

ffmpeg – Create Movie from a Single Image and A Sound file

You see these on youtube a lot, and sound file being played back with a fixed image. This is how to create one using ffmpeg

The -shortest option ensures the video is created the same length as the sound file (the shortest of the two inputs, as the image file will loop forever!

The -loop 1 option (which replaces loop_input) ensures the image file is continuously looped.

one can play around with audio codecs, video outputs and aspect ratios until you have what you want (you can always use -t for time in seconds for testing)

Rolling Video Player

Here is a nice little bash script that will keep repeating the same video over and over. I guess with a bit more work you could have more than one. In this case I used test.mp4 as the video, and as it was only 2 minutes long set a sleep time of 90 seconds. Amend these two parameters to suit

Mplayer: change tempo and pitch of audio file

You may have a need to speed up / slow down and audio file, but would rather not be listening to chipmunks or very deep voices in the process. Also, you may wish to change the pitch of a file whilst maintaining the tempo.

Changing the tempo whilst retaining the same pitch:

this will speed up the playback of the file whilst retaining the same pitch

Changing the pitch whilst retaining the tempo:

On it’s own, this does nothing, a bit more work to do:

edit ~/.mplayer/input.conf and add the following:

and save. Now run the previous command and use the [ & ] keys to change the pitch up and down, by a musical semitone each time.

Nice and Easy Playlist Maker Script with full paths

Just for mp3’s but this works well for Audacious, so might work well for other players too….

It’s a bash script, let’s call it playlistmaker.sh so copy the code and make sure you make it executable.

To run it, you simply need to feed the script a directory location and filename and it will produce a playlist you can put anywhere on the same system:

This points the script at ~/Music and names the playlist music.m3u (which gets saved in your current directory). It will give you full paths to each file, for all mp3 files, recursively. You can of course expand the script by running the line several times and hard coding the directories and filenames, so you can easily update static playlists for specific directories that you might add to regularly.