Showing posts with label video. Show all posts
Showing posts with label video. Show all posts

Tuesday, August 18, 2015

Extract the audio stream from YouTube videos

If you want to extract the audio stream from a video, you can do that with a series of software free and not free, but I prefer to use ffmpeg at the command line. It is very quick and simple.

Beware some video's have multiple audio files. Using the correct demuxing procedure is in order.

In this article I assume you want to extract audio from YouTube Video's with one audio stream


  • Open a terminal screen. (Ctrl+T in Ubuntu) 

  • type: ffmpeg -i inputfile.mp4 -vn -ab 256 outputfile.mp3



for more information visit the FFmpeg site


Friday, December 13, 2013

Changing Meta Info of video files with ffmpeg (command line)

If you want to add or change the meta information of your video/audio files, you probably can find a GUI driven software that does just that for you. But if you happen to work on your media server in command line, and want to change a file here and there via the command line.

You have some options as:

mencoder, ogmtools, mkvtoolsnix, ffmpeg.

Of all the above, ffmpeg seems to support the largest set of container formats.


Example: 

You have a video file: videofile.mkv
and want to add or change some meta data:

title = "My Title",
comments = "My Comments"


Here is how you do it @ the command line, given you have ffmpeg and the needed codexes installed properly.


ffmpeg -i videofile.mkv -vcodec copy -acodec copy -metadata title="My Title" -metadata comments="My Comments" NewFile.mkv



Other meta tags you can manipulate for audio & video files are:


album        -- name of the set this work belongs to
album_artist -- main creator of the set/album, if different from artist.
                e.g. "Various Artists" for compilation albums.
artist       -- main creator of the work
comment      -- any additional description of the file.
composer     -- who composed the work, if different from artist.
copyright    -- name of copyright holder.
creation_time-- date when the file was created, preferably in ISO 8601.
date         -- date when the work was created, preferably in ISO 8601.
disc         -- number of a subset, e.g. disc in a multi-disc collection.
encoder      -- name/settings of the software/hardware that produced the file.
encoded_by   -- person/group who created the file.
filename     -- original name of the file.
genre        -- <self-evident>.
language     -- main language in which the work is performed, preferably
                in ISO 639-2 format. Multiple languages can be specified by
                separating them with commas.
performer    -- artist who performed the work, if different from artist.
                E.g for "Also sprach Zarathustra", artist would be "Richard
                Strauss" and performer "London Philharmonic Orchestra".
publisher    -- name of the label/publisher.
service_name     -- name of the service in broadcasting (channel name).
service_provider -- name of the service provider in broadcasting.
title        -- name of the work.
track        -- number of this work in the set, can be in form current/total.
variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of
 
 
 

Wednesday, February 29, 2012

Convert AC3 audio to mp3 in avi files without re-encoding the Video using FFMPEG

It seems that at some point Archos provided a firmware update that killed the ability to play my home videos (Xvid - MPEG-4/AC-3). I was offered to purchase the "Cinema Plug-in (DVD, MPEG-2, AC3)". Before that firmware update everything worked just fine, so it doesn't feel right to be forced to buy something to fix something that wasn't broken in the first place. If they were able to allow me to see AVI files with AC-3 audio encoding, in the first place, now coming back from it with the excuse you have to buy the codex doesn't sit right with me. If it was like that from the beginning, I wouldn't have any problem to pay my dues to any code-provider, but not after they provide a firmware-upgrade without warning with the changes and specifics.

Friday, December 16, 2011

Edit AVCHD files (*.mts) with Blender or Cinelerra::Convert .mts to DNxHD .mov

AVCHD (*.mts and *.m2ts files) are tough to handle in Blender VSE, or Cinelerra, especially 1440x1080 anamorphic interlaced files. (produced by Canon LEGRIA HF R16)

Using an intermediate file format, better suited for video editing, works for both, Blender and Cinelerra.

Cinelerra (a dedicated NLE) has come long ways, and the community version offers a lot of features, I still find it buggy at times. (has good potential though)
Blender VSE, very professional, but it has a very high learning curve. (so much more than a dedicated NLE)

Wednesday, November 30, 2011

Trim a video file with ffmpeg

You can trim a video using ffmpeg very quickly. (NO transcoding done)


ffmpeg -i Inputfile.mp4 -vcodec copy -acodec copy -ss 00:00:00 -t 00:14:55 TrimmedVideo.mp4

This will Cut your Video to exact 14 minutes and 55 seconds from the start of the video. A very handy tool if your video needs to be below a particular lenght because of upload restrictions.

Thursday, October 13, 2011

Convert 3gp to AVI

Converting a 3gp file in mobile to AVI in Ubuntu.

1) Install mencoder. (Must have repositories multiverse)
Type in terminal:
sudo apt-get install mencoder

2) At Command Line:

Converting a slingle file:

mencoder yourmovie.3gp -ovc lavc -lavcopts vcodec=msmpeg4v2 -oac mp3lame -lameopts vbr=3 -o yourmovie.avi

Wednesday, May 11, 2011

FFMPEG: Convert AVCHD (*.mts, *.m2ts) to H264

Most Camcorders including the "Canon LEGRIA HF R16" record Digital High Definition Video in full HD resolution at 50 frames (interlaced) in mts/m2ts-format.

Cross platform and one of the best compressions out there today is to my personal preference H264

Assuming you have installed ffmpeg and all the libraries you might need,
use the following command to get the job done relatively fast. 

Wednesday, May 4, 2011

FFMPEG: Convert AVCHD (*.mts, *.m2ts) files to AVI files

Most Camcorders including the "Canon LEGRIA HF R16" record Digital High Definition Video in full HD resolution at 50 frames (interlaced) in mts/m2ts-format.

To create more a transportable Standard definition DVD quality progressive avi file,
you can convert them with ffmpeg.

Assuming you have installed ffmpeg and all the libraries you might need,
use the following command to get the job done relatively fast.

Saturday, June 26, 2010

Convert OGV to AVI on Command Line.

Converting ogv files to avi files using mencoder at the command line:

mencoder -idx inputfile.ogv -ovc lavc -oac mp3lame -o outputfile.avi

Note you can add more options for re-sizing, resolution changes etc...  but this will create a decent quality avi.
For more information on all the mencoder options, which is part of the mplayer project, follow this link. http://www.mplayerhq.hu

Monday, June 7, 2010

Video Editing in Blender 2.49b & 2.52alfa2 using ogv input files

In the past when on Hardy Heron (Ubuntu 8.04Lts) and Blender 2.45, you could use the ogg/ogv files created by "RecordMyDesktop" and process them as pleased.

upgraded to Lucid (Ubuntu 10.4Lts) that by default comes with Blender 2.49b in the repositories, You can't use ogv files in blender VSE. (created by "RecordMyDestop").

But there is a workaround:

Sunday, June 6, 2010

FFmpeg: Convert AVI file to series of PNG/JPG images

Extracting a movie file frame by frame and create images (png, jpg) of it. You can set the the frame rate, on how frequent you want an image extracted. Example, if you want to extract 1 image per sec, your rate is 1, if you want to extract every frame of the movie, your frame rate = frame rate of movie.
This technique is used to do a loss-less video editing in tools as Blender, were you can import a sequence of images. This procedure can be very time consuming for long video's, but the quality after editing rewards you for it.
Lets say you do a screen-capture, on a canvas of 1024x768, and created an AVI file with a frame rate of 15 frames per second. (typical for screen casts) you want every frame to be written out as an png-image file, where the numbering is expected to run up to 5 digits. (%05d - option will allow for numbers 5 digits long, padded with zero's)
The command line to do this would look as follows:

Friday, June 4, 2010

Blender 2.49b: No Audio in VSE with Ubuntu 10.4 LTS (Lucid)

Setup:
Ubuntu 10.4 LTS
Blender 2.49b (from distribution or blender.org)

Issue:
Audio files in the Video Editor Sequencer, can't be played.

Solution:
Open Terminal screen,and type: 

sudo gedit  /etc/environment  

Add at the end of the file the following line: 

SDL_AUDIODRIVER=pulse

Save the file and restart computer.

Wednesday, November 18, 2009

MOV to FLV using FFMPEG

Converting a .Mov file to .Flv is strait forward with FFMPEG. Changing canvas and bit rate can be done with simple add-on parameters. Lets say we want to convert a .Mov file with bit rate 7000kb/s and size 320x180 to a .Flv file at a lower bit rate lets say 700kb/s and a different size lets say 464x220. The following command line will do just that.

ffmpeg -i filenamein.mov -acodec copy -vcodec flv -b 700k -s 464x220 filenameout.flv

You will see the following output in your terminal window:

Sunday, October 4, 2009

FLV to SWF Using FFMPEG command line

FFmpeg, is probably one of the most versatile converters around, and used in many projects across platforms.

In Ubuntu, For a quick and dirty way to convert FLV files to SWF files I use:

ffmpeg -i input.flv -acodec copy -vcodec copy output.swf

There is also a GUI-version available (cross-platform) @ http://code.google.com/p/winff/


AVI to SWF using FFmpeg

AVI container file with Video Codex: mpeg4 & Audio Codex: mp3)
In Ubuntu, For a quick and dirty way to convert AVI  files to SWF files I use:
Command line (open terminal)
ffmpeg -i input.avi -acodec copy -vcodec flv output.swf
Note:
you might have to add extra options to change parameters as frame rate, bit rate, ....)

Example output on screen:
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libogg --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 1d.49.3.0
libavcodec version: 1d.51.38.0
libavformat version: 1d.51.10.0
built on Mar 16 2009 21:16:26, gcc: 4.2.4 (Ubuntu 4.2.4-1ubuntu3)

Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 29.97 (30000/1001)

Input #0, avi, from 'input.avi':
Duration: 00:00:39.7, start: 0.000000, bitrate: 1192 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 520x340, 29.97 fps(r)
Stream #0.1: Audio: mp3, 44100 Hz, stereo, 128 kb/s

Output #0, swf, to 'output.swf':
Stream #0.0: Video: flv, yuv420p, 520x340, q=2-31, 200 kb/s, 29.97 fps(c)
Stream #0.1: Audio: 0x0055, 44100 Hz, stereo, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 1190 q=31.0 Lsize=    2132kB time=39.7 bitrate= 439.9kbits/s
video:1479kB audio:621kB global headers:0kB muxing overhead 1.568774%
There is also a GUI-version available (cross-platform) @ http://code.google.com/p/winff/