Hello. I have mp4 videos that I need to convert to AVI. What’s the best tool for the task? I have vlc and I can install avidemux. It should convert with no resolution loss. Thanks.
ffmpeg
ffmpeg -i whatever.mp4 -vcodec mpeg4 -acodec libmp3lame -qscale:v 2 -qscale:a 5 whatever.avi
https://trac.ffmpeg.org/wiki/Encode/MPEG-4
https://trac.ffmpeg.org/wiki/Encode/MP3
Low (0-3) qscale numbers = highest quality = big file. High qscale numbers = lower quality, smaller file size.
Or something like WinFF if you want gui.
For a GUI tool, I’m currently using Handbrake which can be found in Packman.
BTW - the mpg or avi container is likely irrelevant, more likely you will want to consider the codec and compression instead.
TSU
MP4 causes me problems with some linux video players. I want to convert it to a more common format without loosing quality. I’v tried to use handbrake before. I can install the multimedia library. I prefer the linux defaults without all the library changes.
Kdenlive has an option under the File menu to convert any file using a number of pre-defined ffmpeg commands. Not had any problem with any of the results of these pre-defined commands.
Thanks for the info.
What are the major differences between kdenlive and avidemux? Source forge doesn’t list kdenlive?
kdenlive is a KDE program but you can get both from the openSUSE repos
I’ll do a quick step by step example guide for using command line ffmpeg.
Let’s say the music video “Wolf Alice Germ.mp4” is on my desktop. Desktop location being: /home/me/Desktop/
Open up the terminal and change directory to the files location, so open terminal and type: **cd /home/me/Desktop/
**Then copy and paste (and adjust) the command in the first post, or type out:
ffmpeg -i Wolf Alice Germ.mp4 -vcodec mpeg4 -acodec libmp3lame -qscale:v 2 -qscale:a 5 Wolf Alice Germ.avi
Press enter and let ffmpeg do it’s thing, if all goes smoothly it should spit the same file title out, on your desktop, in .avi format - and a much larger file.
So for the documentary, “Serial Killers.mp4”
ffmpeg -i Serial Killers.mp4 -vcodec mpeg4 -acodec libmp3lame -qscale:v 2 -qscale:a 5 Serial Killers.avi
and so on.
Just make sure you change directory to where the file you want to convert is.
.mp4 is not a format - it is just a container and is highly unlikely to be the cause of your playback problems.
.avi is a pretty old (windows) container that is on its way out from general usage.
If all you want to do is change container from .mp4 to .avi then open the file and avidemux. select .avi as your container and save the file. It should take about 10 seconds.
However, it’s much more likely that you are having playback problems because of the file format. You’ll need to find out what that format is. Your player should probably be able to tell you if it is xvid, x264 (h264), x265 (h265), etc . . .
Most commonly used video encode format used now is x264 (used by broadcast networks, video torrent downloads, online streams etc). These will likely be replaced in the future with the newer more efficient x265. Some systems (notably raspberry pis) have problems with the playback of x265 content.
I want to have a linux use only opensource applications. If I add the multimedia library. I get many closed source applications, like mp3 (music) and mp4. I’m going to use converter to make everything opensource programs.
Also, something strange happened. Installing kdenlive kept saying my flash drive was nearly out of space?? The prompt came up about 25 times.
I opened the terminal from the video directory. I want the highest quality video that means “0”.
Videos> ffmpeg -i "NEXUS The Jupiter Incident 2 HD TECH DEMO [HD, 720p].mp4" -vcodec mpeg4 -acodec libmp3lame -qscale:v 2 -qscale:a 5 "NEXUS The Jupiter Incident 2 HD TECH DEMO [HD, 720p].avi"
ffmpeg version 2.8.6 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (SUSE Linux)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-runtime-cpudetect --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-pic --enable-pthreads --enable-vaapi --enable-vdpau --disable-encoders --disable-decoders --disable-muxers --disable-demuxers --enable-encoder=',012v,ansi,apng,bmp,flac,exr,ffv1,ffvhuff,gif,huffyuv,jpegls,libopenjpeg,libtheora,libvpx,pam,pbm,pcx,pgm,png,pgmyuv,ppm,sgi,sunrast,targa,tiff,v210,v308,v408,v410,webp,xbm,xwd,y41p,yuv4,celt,flac,ilbc,opus,pcm_alaw,pcm_bluray,pcm_dvd,pcm_f32be,pcm_f32le,pcm_f64be,pcm_f64le,pcm_mulaw,pcm_s16be,pcm_s16be_planer,pcm_s16le,pcm_s16le_planar,pcm_s24be,pcm_s24le,pcm_s24le_planar,pcm_s32be,pcm_s32le,pcm_s32le_planar,pcm_s8,pcm_s8_planar,pcm_u16be,pcm_u16le,pcm_u24be,pcm_u24le,pcm_u32be,pcm_u32le,pcm_u8,speex,libvorbis' --enable-decoder=',012v,ansi,apng,bmp,flac,exr,ffv1,ffvhuff,gif,huffyuv,jpegls,libopenjpeg,libtheora,libvpx,pam,pbm,pcx,pgm,png,pgmyuv,ppm,sgi,sunrast,targa,tiff,v210,v308,v408,v410,webp,xbm,xwd,y41p,yuv4,celt,flac,ilbc,opus,pcm_alaw,pcm_bluray,pcm_dvd,pcm_f32be,pcm_f32le,pcm_f64be,pcm_f64le,pcm_mulaw,pcm_s16be,pcm_s16be_planer,pcm_s16le,pcm_s16le_planar,pcm_s24be,pcm_s24le,pcm_s24le_planar,pcm_s32be,pcm_s32le,pcm_s32le_planar,pcm_s8,pcm_s8_planar,pcm_u16be,pcm_u16le,pcm_u24be,pcm_u24le,pcm_u32be,pcm_u32le,pcm_u8,speex,ljpeg,v210x,vorbis,vp3,vp5,vp6,vp6a,vp6f,vp8,vp9,otf,ttf,ass,srt,ssa,text' --enable-muxer='flac,gif,image2,image2pipe,matroska,matroska_audio,null,webm' --enable-demuxer='flac,gif,image2,image2pipe,matroska' --enable-x11grab
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'NEXUS The Jupiter Incident 2 HD TECH DEMO [HD, 720p].mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2015-03-02 05:54:03
Duration: 00:03:46.14, start: 0.000000, bitrate: 1885 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1690 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, 2 channels, 191 kb/s (default)
Metadata:
creation_time : 2015-03-02 05:54:06
handler_name : IsoMedia File Produced by Google, 5-11-2011
[NULL @ 0x1f76540] Unable to find a suitable output format for 'NEXUS The Jupiter Incident 2 HD TECH DEMO [HD, 720p].avi'
NEXUS The Jupiter Incident 2 HD TECH DEMO [HD, 720p].avi: Invalid argument
From experience I would simplify the titles till after it’s done converting. I avoid _ - . ] & * and take them out, I also keep titles short as possible. So rename title to; Nexus The Jupiter Incident.mp4 should do fine till after conversion. If it were me I would rename the file to nexus.mp4 till after conversion and then fill the rest in how you like.
If you read that documentation it tells you not to use the lowest settings, highest quality (which are 1-3 not 0-3 like I originally stated), it’s unnecessary and the file size ends ridiculously big with no real benefit. 2 is a good middle ground for the video and 5 is about right for audio, as no extra quality will be gained by going with a lower audio number.
Try it and see for yourself, play around and see what works for you. Get a short youtube .mp4 and play around first for example.
ffmpeg -i "NEXUS_TECH_DEMO.mp4" -vcodec mpeg4 -acodec libmp3lame -qscale:v 0 -qscale:a 0 "NEXUS_TECH_DEMO.avi"
Unable to find a suitable output format for 'NEXUS_TECH_DEMO.avi'
NEXUS_TECH_DEMO.avi: Invalid argument
VLC can’t play mp4. I can load by dragging and dropping the file into window. Then I can play it. However, I can’t transcode to avi format. It only shows convert to mov format. → Transcode failed invalid argument (mov).
I don’t have the multimedia library loaded. After I loaded it, the system slowed to a crawl. I’ll try it again. Any opensource format will work for me.
Now try doing what I actually said 1) rename the file to nexus.mp4 then (2) use the following:
ffmpeg -i nexus.mp4 -vcodec mpeg4 -acodec libmp3lame -qscale:v 2 -qscale:a 5 nexus.avi
ffmpeg -i nexus.mp4 -vcodec mpeg4 -acodec libmp3lame -qscale:v 2 -qscale:a 5 nexus.avi
FYI, I’v installed the multimedia package, no stalls yet.
‘unable to find format, invalid argument.’
I tried to use the GUI WINFF. It’s the same error??
That was a bug in ffmpeg. The online update fixed it. WINFF gui (ffmpeg) works good now. Thanks to all for the help.