Log in

View Full Version : convert AVI/AVC/PCM to MP4/AVC/AAC, don't reencode video


florinandrei
24th May 2015, 04:27
I have Sony Vegas 11 (some kind of home edition, not the full pro version). This is the NLE I am comfortable with. The OS is Windows 7.

One problem is that the MPEG4 encoder in Vegas is quite primitive. I've found a way to make Vegas use x264 for video output: install x264vfw, and then from within Vegas do the final render as VFW (and select x264vfw as the encoder).

The output is an AVI container, with the video track encoded by x264 (AVC), and the audio track PCM. So far so good.

I am looking now for a way to transform that into an MP4 file, with AAC audio, and with the video track just copied (without re-encoding) from the AVI file. Sounds like a simple task, but everything I've tried so far has failed.

I've tried Avidemux but it crashes when I try to export the file.

I've tried VLC, it does generate an MP4/AVC/AAC file, but only VLC can play it. Windows Media Player says it can't play it, which is an indication the file is probably nonstandard in some way.

I could also do a render from Vegas just for the audio track, and then mux it with the video somehow. I've tried to use Yamb to extract the video track from AVI but it crashes when opening the AVI file.

I'm kind of out of ideas now. Any suggestion is appreciated. Thank you.

videoh
24th May 2015, 04:55
You can use mp4box. Make sure it is the latest version.

AVI (.avi) – Only MPEG-4 SP/ASP video and MP3 audio supported at the current time. To import AVC/H264 video, you must first extract the avi track with MP4Box -aviraw video file.avi.

I assume you can find a way to get the audio out, transcode it to AAC, and then remux with the video using mp4box. I suppose -aviraw can be used for the audio tracks as well.

stax76
24th May 2015, 06:57
I wanted to suggest StaxRip as GUI but MP4Box returns a error I don't understand:

"D:\Projekte\GitHub\staxrip\bin\Apps\MP4Box\MP4Box.exe" -fps 25.000000 -add "D:\Temp\test.avi#video:name=Video:par=1:1" -add "D:\Temp\test temp files\test ID2 Audio Stream_out.m4a#audio:lang=und:name=Audio Stream" -new "D:\Temp\test.mp4"

Unsupported AVI audio format
Error importing D:\Temp\test.avi#video:name=Video:par=1:1: Feature Not Supported


General

Audio_Codec_List : MPEG-1 Audio layer 3
Codec/String : AVI
FileSize/String4 : 10.52 MiB
Duration/String1 : 4mn 55s 400ms
OverallBitRate/String : 299 Kbps
FrameRate/String : 25.000 fps
FrameCount : 7385
StreamSize/String : 354 KiB (3%)
File_Created_Date_Local : 2015-05-24 07:28:12.535
File_Modified_Date_Local : 2005-08-26 18:57:18.916

Video

ID : 0
Format_Profile : Advanced Simple@L5
Codec/String : XviD
Duration/String1 : 4mn 55s 400ms
BitRate/String : 129 Kbps
Width/String : 320 pixels
Height/String : 240 pixels
PixelAspectRatio : 1.000
DisplayAspectRatio/String : 4:3
FrameRate/String : 25.000 fps
FrameCount : 7385
Resolution/String : 8 bits
ScanType : Progressive
Compression_Mode : Lossy
StreamSize/String : 4.54 MiB (43%)
Encoded_Library : XviD0037

Audio

ID : 1
Format_Profile : Layer 3
Codec/String : MPEG-1 Audio layer 3
Duration/String1 : 4mn 55s 397ms
BitRate_Mode : CBR
BitRate/String : 160 Kbps
Channel(s)/String : 2 channels
SamplingRate/String : 48.0 KHz
Compression_Mode : Lossy
Video_Delay : 24
StreamSize/String : 5.63 MiB (54%)
Title : Audio Stream

StaxRip can also use ffmpeg as MP4 muxer but it don't work either which looks like a StaxRip bug.

florinandrei
24th May 2015, 07:28
Yup, that was it, mp4box solved the problem for me. I actually also installed the mp4box gui and used that instead of running just the CLI utility, but it worked pretty well. I can render an audio-only file from Vegas, with an AAC track, I extract the AVC video from the AVI with mp4box, then I mux A and V with mp4box. The result seems to be playable everywhere.

The process works reasonably well, since audio rendering and demuxing / remuxing are quick and easy.

Thanks!

videoh
24th May 2015, 14:31
Thanks! Happy to be able to assist you.