Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
Registered User
Join Date: Feb 2014
Posts: 6
|
M2TS, FFMPEG, Sony Vegas, and Me
I wasn't 100% sure where this should go, since it could technically fall under video capture, alternative A/V containers, MPEG4, and maybe Virtual Dub. So maybe I'm a big idiot, but I've been tearing my hair out about this for a week now; at the very least maybe somebody here could point me to another forum where I could get the answers I need. Regardless, this is going to be kind of a long post, so buckle in.
Anyway! I bought a Roxio Gamecap HD Pro because it was the cheapest high-def capture device and it seems you get what you pay for. The device records to Blu-ray style M2TS files. The primary issue is that I cannot edit these M2TS files in Sony Vegas; Vegas does not understand the flavor of AAC it is using. I have thrown these M2TS files at everything I can think of; Avidemux, tsmuxer, easyh264, VirtualDub, etc. Sometimes it will convert the files but take an impractical amount of time (4+ hours for a 15 minute clip), other times it will convert files quickly but Vegas still has trouble. Roxio's official solution is to use their sluggish, bloated Videowave software to convert to MP4, but that gives me no control over bitrate and produces sub-par results. I decided to turn to FFMPEG, because FFMPEG can handle anything. Unfortunately, either FFMPEG cannot handle these files, or I am using FFMPEG wrong.
Code:
ffmpeg.exe -i %1 -c:v mjpeg -b:v 60000k -c:a pcm_s16le %1_COPY.avi
Code:
ffmpeg.exe -ss 00:02:46.000 -i %1 -to 00:02:44.000 -c:v mjpeg -b:v 60000k -c:a pcm_s16le %1_COPY.avi
Code:
ffmpeg.exe -i %1 -c:a pcm_s16le %1_COPY.wav ffmpeg.exe -i %1 -i %1_COPY.wav -shortest -map 0:0 -map 1:0 -c:v mjpeg -b:v 60000k %1_COPY.avi
Code:
ffmpeg.exe -i %1 -c:a pcm_s16le %1_COPY.wav ffmpeg.exe -i %1 -c:v mjpeg -b:v 60000k -an %1_COPY.avi ffmpeg.exe -i %1_COPY.avi -i %1_COPY.wav -shortest -map 0:0 -map 1:0 -c:v copy %1_FINAL.avi
Code:
ffmpeg.exe -i %1 -c:a pcm_s16le %1_COPY.wav ffmpeg.exe -i %1 -c:v mjpeg -b:v 60000k -an %1_COPY.avi If you need the full console output from FFMPEG, here's one such: Code:
C:\Documents and Settings\Ryan>"F:\fraps\Roxio\ffmpeg.exe" -i F:\fraps\Roxio\2-1 7-2014_10.m2ts -c:v mjpeg -b:v 60000k -c:a pcm_s16le F:\fraps\Roxio\2-17-2014_1 0.m2ts_COPY.avi ffmpeg version N-60572-gccc48b3 Copyright (c) 2000-2014 the FFmpeg developers built on Feb 12 2014 22:01:44 with gcc 4.8.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 63.101 / 52. 63.101 libavcodec 55. 52.101 / 55. 52.101 libavformat 55. 32.100 / 55. 32.100 libavdevice 55. 9.100 / 55. 9.100 libavfilter 4. 1.102 / 4. 1.102 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 libpostproc 52. 3.100 / 52. 3.100 [mpegts @ 02a5a960] PES packet size mismatch Input #0, mpegts, from 'F:\fraps\Roxio\2-17-2014_10.m2ts': Duration: 00:04:34.76, start: 1.200000, bitrate: 12179 kb/s Program 1 Stream #0:0[0x1011]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1 280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc Stream #0:1[0x10f]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, f ltp, 9 kb/s [swscaler @ 02b46ca0] deprecated pixel format used, make sure you did set range correctly Output #0, avi, to 'F:\fraps\Roxio\2-17-2014_10.m2ts_COPY.avi': Metadata: ISFT : Lavf55.32.100 Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj420p, 1280x720 [SAR 1:1 D AR 16:9], q=2-31, 60000 kb/s, 59.94 tbn, 59.94 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 (h264 -> mjpeg) Stream #0:1 -> #0:1 (aac -> pcm_s16le) Press [q] to stop, [?] for help Code:
[mpegts @ 02a5a960] PES packet size mismatch [h264 @ 02c85400] error while decoding MB 20 9, bytestream (-6) [aac @ 02a5eb00] Input buffer exhausted before END element found Error while decoding stream #0:1: Invalid data found when processing input [h264 @ 02c85400] concealing 2909 DC, 2909 AC, 2909 MV errors in B frame video:2010209kB audio:51344kB subtitle:0 data:0 global headers:0kB muxing overhe ad 0.034985% https://www.dropbox.com/s/5g15ahhu4968m1r/2-11-2014_04.7z.001 (499mb) https://www.dropbox.com/s/j1msqzf2fi2w3a4/2-11-2014_04.7z.002 (499mb) https://www.dropbox.com/s/hx0140kafjefifq/2-11-2014_04.7z.003 (153mb) If that's too big, I can try to upload something a little smaller, instead. I have my fingers crossed that somebody here can help me out. The Roxio was "cheap", but it was still $120 out of my pocket. Last edited by TheLostSkeleton; 22nd February 2014 at 12:17. |
![]() |
![]() |
![]() |
#2 | Link |
Registered User
Join Date: Feb 2006
Posts: 1,076
|
Have you trioed eac3to to demux your capture and remux video/audio into another container converting audio if needed? See: http://forum.doom9.org/showthread.php?t=125966
|
![]() |
![]() |
![]() |
#3 | Link | |
Registered User
Join Date: Feb 2014
Posts: 6
|
Quote:
Then again, looking more in depth at the eac3to documentation, I feel a little over my head. I tried feeding it an M2TS file to get it to convert to WAV and it told me "Unfortunately eac3to doesn't contain an (LGPL) AAC decoder." So either I track down a highly-specific version of Nero from eight years ago, or... what, exactly? |
|
![]() |
![]() |
![]() |
#4 | Link |
47.952fps@71.928Hz
Join Date: Mar 2011
Posts: 940
|
Why not save to AVI with lossless video compression, like UT Video Codec Suite?
Limiting yourself to FFMPEG only is quite a drawback to NLE editing. Lossless video codecs should be VFW-friendly, which in turn, should be friendly for Sony Vegas. It shouldn't take much at all to index the recorded stream and then frameserve it to VirtualDub via Avisynth for a lossless video format to edit in Sony Vegas.
__________________
Win10 (x64) build 19041 NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4) NTSC | DVD: R1 | BD: A AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
|
![]() |
![]() |
![]() |
#5 | Link | |
Registered User
Join Date: Feb 2014
Posts: 6
|
Quote:
I'm not especially familiar with Avisynth, though. I poked at it once a few years ago but never bothered to learn much of anything about it; how much setup are we talking, here? Part of the reason I was using FFMPEG is because I've actually written a (strictly for personal use) FFMPEG front-end before and I had planned on finding encoding settings that "worked" and adapting them to that, automating the conversion process so I could do large groups of files easily. From what I remember about Avisynth, wouldn't I have to write a separate script file for each individual video? |
|
![]() |
![]() |
![]() |
#6 | Link | |
Registered User
Join Date: Feb 2006
Posts: 1,076
|
Quote:
Last edited by G_M_C; 23rd February 2014 at 11:19. |
|
![]() |
![]() |
![]() |
#7 | Link |
Registered User
Join Date: Dec 2001
Posts: 145
|
I've had some issues with Movie Studio (the consumer version of Vegas Pro) opening m2ts files (not similar to yours, though).
However, h264+aac in mp4 has worked fine instead of m2ts, so you could just try remuxing with ffmpeg -i file.m2ts -c:v copy -c:a copy file.mp4 (based on your output, the files are h264+aac inside m2ts). If that doesn't work, you could try reconverting the audio (as that seems to be the issue) just with ffmpeg -i file.m2ts -c:v copy -c:a aac -strict -2 -b:a 240k -r:a 48000 -async 1 file.mp4. I'm using -async 1 because you seem to have some issues with the audio. I've noticed ffmpeg does not deal with any start packet mismatch or gaps in audio (or vfr files) properly (missing audio, video/audio not in sync etc) without async specified. Not the ideal solution (conversion is not lossless), but give it a try in case that would at least get you forward. If that works, you could try with pcm_s16le (with the async option) if that helps. |
![]() |
![]() |
![]() |
#8 | Link | ||
Registered User
Join Date: Feb 2014
Posts: 6
|
Quote:
Upon trying to copy video and audio, FFMPEG yelled at me to use -bsf:a aac_adtstoasc because of malformed data. Doing so did the trick, but... now both options you provided generate an even more frustrating issue: Sony Vegas has a history of not liking MPEG4 in general, and I was surprised when it imported the M2TS video track so well. Using your options, while I get an audio and a video track in Sony Vegas, I get nasty looking video corruption (example) or, more often than not, Vegas just claims the video track is completely black. I feel like I'm going a little crazy, though; using -async, FFMPEG magically stopped returning errors upon finishing encoding, and I generated a few files that actually opened in Vegas "fine" by adding it to the existing commands I used in the OP (though they were missing the last 15 seconds of audio). Except... then that mysteriously stopped happening and now it's generating errors again, even though I'm using identical commands. Quote:
I am completely lost. Last edited by TheLostSkeleton; 23rd February 2014 at 18:29. |
||
![]() |
![]() |
![]() |
#9 | Link |
Registered User
Join Date: Feb 2014
Posts: 6
|
Okay, so, the black MP4 problem was caused because Vegas was latching on to Quicktime's MP4 decoder.
Now that I've disabled that, it's using Vegas' own internal MP4 decoder (mcmp4plug2.dll), which "works"... but now the M2TS->MP4 files break up like that example image. The good news is, I figured out how to get it to stop spitting out AAC errors after encoding; I think I mixed up the order of some commands before. This gives me no errors about AAC encoding (but mpegts still complains about a "PES packet size mismatch"): Code:
"F:\fraps\Roxio\ffmpeg.exe" -i %1 -c:v copy -c:a copy -flags +global_header -async 1 -bsf:a aac_adtstoasc %1.mp4 Recompressing just using the -v:c mpeg4 doesn't work, x264 is one of those codecs that will take HOURS for a clip that's only a few minutes long... hmmmm. It's super round-about, but it seems like I can copy everything to MP4, which VirtualDub has a much easier time opening and dealing with... and from there I guess I could recompress it to XVID. For whatever reason, Sony Vegas doesn't like the version of XVID used by FFMPEG, but it likes whatever version VirtualDub feeds in to. It used to be, back with my old 480i capture card, I'd take the raw captures and when I deinterlaced them/filtered them for clean-up, I'd also recompress them to XVID at max bitrate. It's still slow, but 35 minutes to compress a 4 minute clip is a lot better than 2+ hours. Not a clean solution, but it... works, I guess. ![]() |
![]() |
![]() |
![]() |
#10 | Link |
Registered User
Join Date: Jul 2005
Posts: 19
|
I do not know much about this encoding stuff, I simply gave a try to encode your 16min44 1.2Gb m2ts file into your requirements
which, I guess are AVI M-JPEG, WAV-sowt(pcm16) encoding went flawlessly with no error whatsoever. I didn't go through the entire 16 min, I just did 60 sec with an 84Mb output result. it took barely a minute. so.. here's the output for your eyes and mostly for your vegas tests.. http://cs0001.free.fr/-/2-11-2014_04.AVI |
![]() |
![]() |
![]() |
#11 | Link | |
Registered User
Join Date: Feb 2014
Posts: 6
|
Quote:
|
|
![]() |
![]() |
![]() |
#12 | Link |
Registered User
Join Date: Jul 2005
Posts: 19
|
I re-encoded the entire length of 16min44 into AVI M-JPEG, WAV-sowt(pcm16)
it took 11min20 on my VAIO laptop to complete the conversion. No error of any kind during encoding or during playing the resultant output. Perfect Audio Synch, 1.4GB output filesize zipped+split into 6 parts http://cs0001.free.fr/--/2-11-2014_04.ZIP 42MB http://cs0001.free.fr/--/2-11-2014_04.Z01 250MB http://cs0001.free.fr/--/2-11-2014_04.Z02 250MB http://cs0001.free.fr/--/2-11-2014_04.Z03 250MB http://cs0001.free.fr/--/2-11-2014_04.Z04 250MB http://cs0001.free.fr/--/2-11-2014_04.Z05 250MB Couldn't test it with vegas as i have no intention to install vegas. |
![]() |
![]() |
![]() |
Tags |
aac, ffmpeg, gamecap, m2ts, roxio |
Thread Tools | Search this Thread |
Display Modes | |
|
|