I have a very old .AVI file and am trying to convert this into MP4 format with FFMPEG
Here is my current command to try and convert:
ffmpeg -i aVideo.avi -s 1980x1080 -c:a copy aNewVideo.mp4
I am using version ffmpeg version 4.2.4-1ubuntu0.1
Edit
Here is the sh script I have created to easily let me convert videos to be able to share with my pals. Not my best work... I'm a JS dev :O
hutber@hutber:/mnt/users/Downloads/Old$ sd
Select Resolution:
1) 1280x720
2) 1980x1080
#? 1
/mnt/users/Downloads/Old/1011 Random Goal 1.avi
/mnt/users/Downloads/Old/02.12.2021/1011 Random Goal 1.avi_02.12.2021_00.31_SD.mp4
ffmpeg -i /mnt/users/Downloads/Old/1011 Random Goal 1.avi -s 1280x720 -c:a copy /mnt/users/Downloads/Old/02.12.2021/1011 Random Goal 1.avi_02.12.2021_00.31_SD.mp4
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
WARNING: library configuration mismatch
avcodec configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-liblensfun --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from '/mnt/users/Downloads/Old/1011 Random Goal 1.avi':
Duration: 00:01:09.72, start: 0.000000, bitrate: 30356 kb/s
Stream #0:0: Video: dvvideo (dvsd / 0x64737664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 28816 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (dvvideo (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x562e372efc40] using SAR=3/4
[libx264 @ 0x562e372efc40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x562e372efc40] profile High, level 3.1
[libx264 @ 0x562e372efc40] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x562e372ee600] Could not find tag for codec pcm_s16le in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
Conversion failed!
With this being the script:
hutber@hutber:/mnt/users/Downloads/Old$ cat /mnt/googledrive/Documents/sh/sd.sh
#!/bin/bash
simpleCopy(){
printf "Select Resolution:\n"
select answer in "1280x720" "1980x1080"
do
break;
done
}
simpleCopy
file=$(zenity --file-selection)
currentDateTime=$(date +'%m.%d.%Y_%H.%M')
currentDate=$(date +'%m.%d.%Y')
safeVideoName="${file/ /_}"
safeVideoName="${file/.mp4/}"
safeVideoName="${file/.mp4/}"
filename=${safeVideoName##*/}
fullpath="${safeVideoName%/*}/$currentDate"
videoName="${fullpath}/${filename}_${currentDateTime}_SD.mp4"
echo $file
echo $videoName
mkdir -p $fullpath
echo "ffmpeg -i "$file" -s "$answer" -c:a copy "$videoName""
ffmpeg -i "$file" -s "$answer" -c:a copy "$videoName"
It appears that FFmpeg is not happy putting the following input audio stream into an mp4 container, as you have requested with
-c:a copy
:An easy workaround is to simply convert the pcm_s16le stream to something that FFmpeg is happy to place in such a container. One good choice is to use the FFmpeg native AAC encoder and this can be done as follows:
A better choice for AAC would actually be to use the Fraunhofer FDK AAC (libfdk_aac) encoder with FFmpeg but some hands-on wrangling (compiling) would be required to get this going and you will be more than happy with the quality of the native AAC encoder.
Perhaps as well you could give some specific options for the video encode? The defaults are pretty sane but you might be better with something like the following:
And then experiment with all of these options to find best quality vs size of your output video...