LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-22-2010, 09:50 AM   #1
vtbludgeon
Member
 
Registered: Sep 2002
Location: New Jersey, USA
Distribution: Ubuntu, Xubuntu, Debian
Posts: 62

Rep: Reputation: 16
magic words wanted ffmpeg avi to mp4 conversion for youtube


I have been scraping and clawing all over the Web, trying and erring for long enough to give up and ask you:

I want to convert AVI files created on my Canon digital camera to a youtube-friendly format. Youtube says: "you may get the best uploading results from converting your file to MPEG4 video with MP3 audio" and they suggest ffmpeg. Unfortunately I don't understand what I am doing, just trying to slavishly follow the recipe. I am running this version of ffmpeg:

Code:
FFmpeg version SVN-r19352-4:0.5+svn20090706-2ubuntu2.2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5+svn20090706-2ubuntu2.2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --extra-cflags=-I/build/buildd/ffmpeg-0.5+svn20090706/debian/include --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 0 / 52.20. 0
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Apr 23 2010 15:05:49, gcc: 4.4.1
I have tried countless command-line invocations of ffmpeg and gotten various fatal errors. Rather than paste all the clutter in here, I pose the question: what is the command to tell ffmpeg to convert input.avi to an MPEG-4 video with MP3 audio?

PS I know Youtube will accept my AVI and do the processing for me. I also know they recommend give you them your original instead of mucking with it yourself. But a 2-minute AVI is over 200MB and I want something that will upload faster. Of course this has taken me 25 times longer than the AVI upload would have (-:

Gratefully,

Last edited by vtbludgeon; 06-22-2010 at 09:56 AM.
 
Old 06-22-2010, 12:00 PM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
What format is the avi file ? mpeg4 is a codec, avi is a container for many formats. If fact mpeg4 can be contained by an avi.

But having said that, there is an example in man ffmpeg :

Code:
 
* You can transcode decrypted VOBs

ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800 -g 300 -bf 2 -acodec mp3 -ab 128 snatch.avi
Quote:
This is a typical DVD ripping example; the input is a VOB file, the
output an AVI file with MPEG-4 video and MP3 audio. Note that in this
command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
GOP size is 300 which means one intra frame every 10 seconds for
29.97fps input video. Furthermore, the audio stream is MP3-encoded so
you need to enable LAME support by passing "--enable-mp3lame" to con-
figure. The mapping is particularly useful for DVD transcoding to get
the desired audio language.

NOTE: To see the supported input formats, use "ffmpeg -formats".
Try using that with the relevant modifications.
 
Old 06-22-2010, 12:16 PM   #3
vtbludgeon
Member
 
Registered: Sep 2002
Location: New Jersey, USA
Distribution: Ubuntu, Xubuntu, Debian
Posts: 62

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by smoker View Post
What format is the avi file ? mpeg4 is a codec, avi is a container for many formats. If fact mpeg4 can be contained by an avi.
Ah! Thank you, now I am slightly less ignorant than before.

Quote:
Originally Posted by smoker View Post
But having said that, there is an example in man ffmpeg :[...]
Yes I saw that, but it's going in the opposite direction from what I am trying to do. My input file is AVI, not my output. Truth to tell, as I mentioned before, I don't understand this stuff.

Nevertheless... I tried this:
Code:
  ffmpeg -i cards.avi -vcodec mpeg4 -acodec mp3 cards.mp4
and got this:
Code:
FFmpeg version SVN-r19352-4:0.5+svn20090706-2ubuntu2.2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5+svn20090706-2ubuntu2.2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --extra-cflags=-I/build/buildd/ffmpeg-0.5+svn20090706/debian/include --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 0 / 52.20. 0
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Apr 23 2010 15:05:49, gcc: 4.4.1
Input #0, avi, from 'cards.avi':
  Duration: 00:01:55.00, start: 0.000000, bitrate: 15721 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 30 tbr, 30 tbn, 30 tbc
    Stream #0.1: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Unknown encoder 'mp3'
It looks like I got some information about the input file there, right?

I hypothesize that my ffmpeg was not compiled with support for whatever. I got it by way of 'apt-get install.' Or is there something else I could apt-get that would resolve some dependency? Or is there something else I'm not doing right?

Last edited by vtbludgeon; 06-22-2010 at 12:29 PM.
 
1 members found this post helpful.
Old 06-22-2010, 12:52 PM   #4
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
You need lame support to use mp3.
Quote:
Furthermore, the audio stream is MP3-encoded so
you need to enable LAME support by passing "--enable-mp3lame" to con-
figure.
I don't know how you achieve that other than recompiling ffmpeg (which isn't a bad idea really) Get it from svn and build it yourself, there are plenty of howtos for just about all distros.

The process as described is not going in reverse. Remember I said avi is a container format ?
Quote:
This is a typical DVD ripping example; the input is a VOB file, the
output an AVI file with MPEG-4 video and MP3 audio
.
Also, your output file extension is mp4. This can get confusing. mp4 files can be created using the h264 codec, but mp4 is a container just like avi. mpeg4 is more extensive than that. xvid and divx are mpeg4 codecs but can output files as avi !
http://www.xvid.org/Project-Info.46.0.html
http://www.apple.com/quicktime/techn.../h264/faq.html
http://en.wikipedia.org/wiki/MPEG-4_Part_14

Last edited by smoker; 06-22-2010 at 01:10 PM.
 
Old 06-22-2010, 01:41 PM   #5
fruttenboel
Member
 
Registered: Jul 2008
Location: Tilburg NL
Distribution: Slackware 14.2 ciurrent, kernel 3.18.11
Posts: 270

Rep: Reputation: 48
Quote:
Originally Posted by vtbludgeon View Post
I have been scraping and clawing all over the Web, trying and erring for long enough to give up and ask you:

I want to convert AVI files created on my Canon digital camera to a youtube-friendly format. Youtube says: "you may get the best uploading results from converting your file to MPEG4 video with MP3 audio" and they suggest ffmpeg. Unfortunately I don't understand what I am doing, just trying to slavishly follow the recipe.
Just upload the AVI. YouTube will do the converting for you.

If I want to save a flash move to avi I do:
Code:
ffmpeg -i /tmp/Flash12sew MyFilm.avi
and that works fine all the time.
 
Old 06-22-2010, 03:39 PM   #6
vtbludgeon
Member
 
Registered: Sep 2002
Location: New Jersey, USA
Distribution: Ubuntu, Xubuntu, Debian
Posts: 62

Original Poster
Rep: Reputation: 16
I think that's a good idea. I will compile my own ffmpeg binary from source if and when I have time for that.

Thanks.
 
Old 06-23-2010, 12:13 PM   #7
vtbludgeon
Member
 
Registered: Sep 2002
Location: New Jersey, USA
Distribution: Ubuntu, Xubuntu, Debian
Posts: 62

Original Poster
Rep: Reputation: 16
OK, Youtube thought about it for over 24 hours before deciding it won't accept my AVI from my little Canon Powershot, so... I manned up and compiled my own ffmpeg from source checked out from svn.

For ./configure I simply said --enable-libmp3lame. And now...

ffmpeg -i cards.avi -vcodec mpeg4 -acodec mp3 cards.mpg
Code:
FFmpeg version SVN-r23738, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jun 23 2010 11:54:46 with gcc 4.4.1
  configuration: --enable-libmp3lame
  libavutil     50.19. 0 / 50.19. 0
  libavcodec    52.78. 0 / 52.78. 0
  libavformat   52.71. 0 / 52.71. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.20. 0 /  1.20. 0
  libswscale     0.11. 0 /  0.11. 0
Input #0, avi, from 'cards.avi':
  Metadata:
    ISFT            : CanonMVI06
  Duration: 00:01:54.99, start: 0.000000, bitrate: 15721 kb/s
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 30 tbr, 30 tbn, 30 tbc
    Stream #0.1: Audio: pcm_s16le, 44100 Hz, 1 channels, s16, 705 kb/s
Unknown encoder 'mp3'
So you see -- compiled from source with libmp3lame support, and still "unknown encoder mp3." Any advice? Some magic words missing from my configure command, perhaps?

Thanks.

Last edited by vtbludgeon; 06-23-2010 at 12:17 PM.
 
Old 06-23-2010, 12:47 PM   #8
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
I guess you didn't install libmp3lame first then.
https://wiki.ubuntu.com/ffmpeg
 
Old 06-23-2010, 12:56 PM   #9
vtbludgeon
Member
 
Registered: Sep 2002
Location: New Jersey, USA
Distribution: Ubuntu, Xubuntu, Debian
Posts: 62

Original Poster
Rep: Reputation: 16
I believe I did:


apt-get install lame
Code:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
lame is already the newest version.
apt-get install libmp3lame-dev
Code:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libmp3lame-dev is already the newest version
But... let me read your URL (been there before) and give it a shot. Am I gonna shoot myself in the foot if I run those commands even though it doesn't explicitly say they're for my distro (9.10)?

Last edited by vtbludgeon; 06-23-2010 at 12:59 PM.
 
Old 06-23-2010, 01:07 PM   #10
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
I don't think you can hurt things too much, as long as a package is available for your version, it shouldn't matter. If you already have it, it won't install or it will complain.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
FFMPEG - test.mp4: unknown format kingkashif Linux - Software 4 11-17-2009 09:11 AM
Green screen after video conversion, AVI to MP4 using Mencoder,Mplayer,FFmpeg,x264, manuken Linux - Newbie 4 10-29-2008 07:40 PM
ffmpeg - psp [] Need help encoding to mp4 nomb Linux - Software 7 01-08-2007 08:42 PM
FFMPEG vs MPLAYER vs MENCODER and batch conversions to MP4 ? AngusM Linux - Software 2 11-08-2006 09:20 AM
file magic for m4a (mp4) ?? fsbooks Linux - Software 1 01-23-2004 09:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration