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. |
14th November 2018, 20:44 | #1 | Link |
Registered User
Join Date: Jul 2002
Posts: 241
|
VD2 External Encoder questions
In the "compress" dialog (ctrl-P) I was "force of habit" choosing "x264vfw H.264/MPEG-4 ACV codec", thinking it is the "best", however, was alerted that is probably not the best/latest X264 to use.
Few lines above it has: "x264 8 bit H.264/MPEG-4 ACV codec" as well as 10 bit.. although these seem to be same r2851, and i was told to use r2935... Question1: Is there a way for "me" to some how update the x264 to r2935 (without recompiling source codes) or must this be done by the developer of VD2? Question2: If "External Encoder" is the only option to get r2935 (latest) to work, is there a way to configure it to only encode the VIDEO, and leave the audio AS-IS, i.e. not compress at all? (direct copy stream) ? I've setup the external encoding, and it works (aside from projected file size going all over the map), however, could not figure how to disable the Audio encoding.. 1) tried setting "Audio encoder" to NONE in the edit external encoder SET. that failed during encoding audio. 2) Tried creating an audio encoder that supposedly is a "noop", just "copy stream" with these arguments: Program: \Bin\FFMpeg\ffmpeg.exe command arguments: -y -i - -codec copy "%(tempaudiofile)" output filename: %(outputname).audio but that failed as well: Code:
--------------------------- VirtualDub Error --------------------------- The audio encoding process has prematurely exited with an error code of 1 (00000001). Check the log for possible error messages. --------------------------- OK --------------------------- Does anyone have a way to run latest X264 codec without external encoders? otherwise, if someone is using external encoders, how does one setup audio copy stream, instead of compressing it. Thanks much for any tips. Stormy. |
18th November 2018, 04:10 | #2 | Link |
Registered User
Join Date: Mar 2015
Posts: 775
|
Q1: no, the codec must be recompiled with updated x264 library. Do you have any references why is r2935 preferred over r2851?
Q2: not 100% sure if this workflow is possible or not.
__________________
VirtualDub2 |
18th November 2018, 12:18 | #3 | Link | |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
Quote:
I once managed to do direct stream copy with external encoders as well. Worked with ffmpeg as "encoder". Pass raw audio data (do not "bypass compression") to ffmpeg with stream copy and output as e.g. raw .ac3 or something. The input filter is important because some of them decode the audio instead of passing the compressed bitstream to VirtualDub. (I tested these on VirtualDub 1.10.4, though. Maybe some things broke in VirtualDub2.) Don't expect any big differences between r2851 vs r2935. |
|
18th November 2018, 18:52 | #4 | Link |
Registered User
Join Date: Jul 2002
Posts: 241
|
1) I guess the r2935 was just by chance, i.e. the current version.. I was using the x264vfw (naively thinking that as long as x264 is in the name, I'm good it was mentioned here:
https://forum.doom9.org/showthread.p...69#post1857369 2) As for encoding withOUT re-compressing the audio.. you suggest to have a muxer with video only?? won't the final file have NO audio? since only Video is packed there? I tried to create an AUDIO "encoder" using "ffmpeg" with these flags: "-y -i - -codec copy "%(tempaudiofile)"" Tried running it on a simple .mp3 and this is the output, so clearly that will also fail in the VD2 pipeline: Code:
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 8.2.1 (GCC) 20181017 configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libas s --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenco re-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enab le-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libt wolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --e nable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --en able-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable -libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx -- enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --e nable-nvdec --enable-dxva2 --enable-avisynth libavutil 56. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100 libpostproc 55. 3.100 / 55. 3.100 pipe:: Cannot allocate memory If you have a sample working that would be great, since all my audio is already encoded at source. Stormy. |
18th November 2018, 20:06 | #5 | Link | ||
Registered User
Join Date: Dec 2002
Posts: 5,565
|
Quote:
Quote:
That said, your error message is about memory? Are you doing anything crazy that would require more than 2GB RAM the 32 bit versions support? Then you can try a LARGEADDRESSAWARE build (support for up to 4GB on 64 bit OS) or the 64 bit version. P.S.: in the encoder settings let VirtualDub redirect all messages to the log so it's more complete. |
||
18th November 2018, 22:57 | #6 | Link | ||
Registered User
Join Date: Jul 2002
Posts: 241
|
So I assume the route I'm going to is correct? To somehow create an AUDIO "compressor" that passes data as-is ("direct copy stream"), and a MUXER that does video+Audio? This is what I have, the thing that does not work in the "audio passthrough" and I've posted the results above.. if anyone knows how to make ffmpeg, or any other tool, just somehow pipe it in a format that muxer will understand , do let me know
Quote:
As for input driver, it uses the "Caching input driver", only time when i had to use the Quicktime is to save video "direct copy stream", but i don't do that anymore.. Quote:
System has 8GB of RAM, and 6GB currently used, that said, and unrelated to this error, I should be getting more memory in few days Not sure it makes sense to try in VD2 if command line itself is failing, but did it anyways, just for fun Audio encoding is the "passthrough" as defined earlier, and muxer is normal mp4box for mp4 video + the audio "passthrough". It runs for a bit of time, sections from the log (removing the video parts b/c that part is OK), later it fails with: Code:
--------------------------- VirtualDub Error --------------------------- The audio encoding process has prematurely exited with an error code of 1 (00000001). Check the log for possible error messages. --------------------------- OK --------------------------- This is the Start of the encoding session: Code:
i] video encoder: "C:\Programs\VirtualDub2-42711\Bin\x264\x264.exe" --input-res 1280x720 --fps 30/1 --demuxer raw --input-csp i420 --crf 18 --preset Medium --tune Film --output "M:\temp\test.mp4.video.mp4" - [i] audio encoder: "C:\Programs\VirtualDub2-42711\Bin\FFMpeg\ffmpeg.exe" -y -i - -codec copy "M:\temp\test.mp4.audio" [i] AudioEnc: ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers [i] AudioEnc: built with gcc 8.2.1 (GCC) 20181017 [i] AudioEnc: configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth [i] AudioEnc: libavutil 56. 22.100 / 56. 22.100 [i] AudioEnc: libavcodec 58. 35.100 / 58. 35.100 [i] AudioEnc: libavformat 58. 20.100 / 58. 20.100 [i] AudioEnc: libavdevice 58. 5.100 / 58. 5.100 [i] AudioEnc: libavfilter 7. 40.101 / 7. 40.101 [i] AudioEnc: libswscale 5. 3.100 / 5. 3.100 [i] AudioEnc: libswresample 3. 3.100 / 3. 3.100 [i] AudioEnc: libpostproc 55. 3.100 / 55. 3.100 [i] VideoEnc: raw [info]: 1280x720p 0:0 @ 73/1 fps (cfr) Code:
[i] AudioEnc: [mp3 @ 0062bb80] invalid concatenated file detected - using bitrate for duration [i] VideoEnc: 1376 frames: 28.85 fps, 5243.13 kb/s [i] AudioEnc: [mp3float @ 0062d200] Header missing [i] AudioEnc: Last message repeated 224 times [i] AudioEnc: Input #0, mp3, from 'pipe:': [i] AudioEnc: Duration: N/A, start: 0.025057, bitrate: 104 kb/s [i] AudioEnc: Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 104 kb/s [i] AudioEnc: Metadata: [i] AudioEnc: encoder : LAME3.91 [i] AudioEnc: [NULL @ 006358c0] Unable to find a suitable output format for 'M:\temp\test.mp4.audio' [i] AudioEnc: M:\temp\test.mp4.audio: Invalid argument [i] VideoEnc: 1386 frames: 28.81 fps, 5243.71 kb/s Code:
[E] Error: The audio encoding process has prematurely exited with an error code of 1 (00000001). Check the log for possible error messages. [*] Ending operation. Needless to say the MP3 file is 100% valid and works just fine with VD2's builtin audio multiplexer in "direct copy" mode as well as re-compress, i.e. the mp3 is *valid* and OK, the issue is how to mimic mp3/audio "passthrough" (direct copy) using ffmpeg or any other tool in a fashion that will allow the multiplexer to get the data in the right format (without recompressing the audio). Stormy. |
||
18th November 2018, 23:28 | #7 | Link |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
Code:
[i] AudioEnc: [NULL @ 006358c0] Unable to find a suitable output format for 'M:\temp\test.mp4.audio' Last edited by sneaker_ger; 18th November 2018 at 23:30. |
19th November 2018, 09:10 | #8 | Link |
Registered User
Join Date: Jul 2002
Posts: 241
|
OK!! some PROGRESS!!!!
Now the "audio encoder" called "Audio passthrough" looks like this (running ffmpeg): Code:
-y -i - -codec copy -f mp3 "%(tempaudiofile)" For AVI containers, GSpot freeware shows video/audio components/size, but not for MP4, so picked up a GUI tool called MP4 Inspector: https://sourceforge.net/projects/mp4-inspector/ it shows bunch of stuff, but was not clear how large/format is the audio. Took both resulting mp4 and opened them in VD2, then did 4 export operations (RAW audio and RAW video) of both files. This is a 5min clip in MOV/quicktime format from a DSLR. Video files came as ~23.5GB in size, identical to the number of bytes (prob. content is slightly different). Audio came as 90MB (for the normal audio encoder) vs 46MB (for the -c copy -f mp3 "passthrough" encoder); whereas the resulting MP3 source file is roughly 5 MB.. by comparison, using an AVI container, with the builtin VD functionality, produces an audio track that is 5MB (with direct copy stream). I'm trying to mimic that with external encoder So, the question, is it the case that MP4 container force an "upgrade" of the audio stream, or can mp4 contain the unmodified mp3 stream? Thanks for any thoughts, I'll be happy to test out anything you can think of Stormy. |
19th November 2018, 15:11 | #9 | Link |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
You can put mp3 audio into an mp4 container. Whether or not your player can play mp3-in-mp4 is a different question.
I don't know how reliable GSpot is when it comes to determining audio stream size. If you want to be sure try to extract the audio again from the file. mp3 has a maximum bitrate of 320 kbps. So a 5 min clip should not have more than 12 MB of mp3 data. |
19th November 2018, 18:07 | #10 | Link | |
Registered User
Join Date: Jul 2002
Posts: 241
|
Quote:
One way I found very reliable, but time consuming, is EXPORT RAW AUDIO from VD2; and in the cases of the mp4 container (meaning external encoder), the exported RAW Audio comes 10-15 times the size of the original mp3 (e.g. 5MB vs 40MB+!) Original mp3 is roughly 5MB for ~5 min clip. The exported raw audio comes to more than 40MB!! which means to me that the ffmpeg -c copy -f mp3 is not 100% mp3, OR, the MP4Box muxer "up-converts" this stream into something that is "supported" or "better" for mp4.. OR VD2 is somehow confusing video and audio when it exports raw audio only End goal is to dedicate as much as possible to VIDEO, and leave the audio at the current size, no good will come from re-encoding an already encoded mp3 at ~256kps Any further tips welcomed, and I can test right away.. Stormy. |
|
19th November 2018, 18:27 | #11 | Link |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
In VirtualDub(2) File->Export->Raw audio doesn't necessarily mean it will export the bitstream 1:1 as it is in the source, only as it is delivered by the source filter. I just tried on an mp3-in-mp4 file and it seems to have output PCM (without wav header). If you do File->Save audio you will have the very same PCM but with wav header. But for me this also means such a file wouldn't pass mp3 bitstream through the same source filter.
If you want more insight always post the complete VirtualDub log, export of the External Encoder settings and MediaInfo of input and output files (in "Text" view, "View"->"Text"). |
19th November 2018, 18:30 | #12 | Link |
Registered User
Join Date: Mar 2015
Posts: 775
|
When you select mp3 with "Audio from other file", you should pick "MPEG audio input driver". Do you? 40MB sounds like uncompressed (produced by caching input driver).
__________________
VirtualDub2 |
19th November 2018, 20:06 | #13 | Link |
Registered User
Join Date: Jul 2002
Posts: 241
|
The input driver on initial audio open from file is set to "MPEG audio input driver (internal)".
The issue is very simple. take 5MB mp3, and mux it with VD2's builtin encoder, that results in a very small audio segment, take the AVI, and save Audio, will give back the 5MB audio give or take few bytes, with/out the wav/mp3 header, but still the resulting file is roughly same size, and in MP3 format. Try the same with External encoder, and you cannot get the same mp3 back, b/c it gets up-converted into WAV, much the same way that earlier VirtualDub binaries had a bug and produced AVI with WAV audio despite user selecting "direct copy" and providing an mp3 compressed audio. I do not know enough about muxer to know who is doing it, but it sounds like ffmpeg is doing a simple "copy" so either it is VD2 feeding ffmpeg, OR it is the muxer which expands the mp3 into WAV.. OR, I'm completely lost and there is no way to do that, although find that hard to believe, I just don't have any mp4 with mp3 audio to verify. Look in VD-> File-> File Information. In the mp4 case , it does not look like 100% mp3, it does say encoder mp3, but rest looks different than an avi with mp3 audio track. if u can get an mp4+mp3 inside, or know where i can download one, that would help too, to compare. Stormy |
19th November 2018, 20:56 | #14 | Link |
Registered User
Join Date: Mar 2015
Posts: 775
|
Tried and it works.
This command is ok: Code:
-y -i - -codec copy -f mp3 "%(tempaudiofile)" Otherwise the audio is decoded by internal mp3 decoder. Yeah, intuitive
__________________
VirtualDub2 |
20th November 2018, 09:38 | #15 | Link | |
Registered User
Join Date: Jul 2002
Posts: 241
|
What works? Can you extract the mp3 back from the externally encoded mp4 container, and is it same size as the original mp3? or do you get the PCM/raw/expanded data?
Quote:
So, yeah I do get MP4 containers, however, I think that the AUDIO segment in them is WAV format and not mp3. Can you confirm on your mp4, try save audio, or export audio segment and compare the size of original mp3 This is my profile-SET in effect with full audio processing: Code:
"AVC [Film] (10bit)MP4": { "videoEncoder": "V AVC [Film] (10bit)x264", "audioEncoder": "A AAC @~192K [Qaac]", "multiplexer": "M MP4Box", "description": "*.mp4 (MPEG-4 Part 14)", "extension": "mp4", "processPartial": false, "useOutputAsTemp": false }, Code:
"AVC [Film] (10bit)MP4pass": { "videoEncoder": "V AVC [Film] (10bit)x264", "audioEncoder": "A Passthrough", "multiplexer": "M MP4Box", "description": "*.mp4 (MPEG-4 Part 14)", "extension": "mp4", "processPartial": false, "useOutputAsTemp": false } The "A passthrough" is defined as follows: Code:
"A Passthrough": { "name": "A Passthrough", "program": "C:\\Programs\\VirtualDub2-42711\\Bin\\FFMpeg\\ffmpeg.exe", "commandArguments": "-y -i - -codec copy -f mp3 \"%(tempaudiofile)\"", "outputFilename": "%(outputname).audio", "type": 1, "pixelFormat": "", "inputFormat": 0, "checkReturnCode": true, "logStdout": true, "logStderr": true, "bypassCompression": false, "predeleteOutputFile": true }, Code:
"M MP4Box": { "name": "M MP4Box", "program": "c:\\Programs\\GPAC\\mp4box.exe", "commandArguments": "-add \"%(tempvideofile)\" -add \"%(tempaudiofile)\" -fps %(fps) \"%(outputname)\"", "outputFilename": "", "type": 2, "pixelFormat": "", "inputFormat": 0, "checkReturnCode": true, "logStdout": true, "logStderr": true, "bypassCompression": false, "predeleteOutputFile": true }, Clearly I'm not doing something right, just not sure what it is.. if anyone has external encoder to handle this case, please post the code... until then I'm back to using the internal encoders, just not sure which should be used: X264 10 bit - H.264/MPEG-4 AVC codec OR: X264 8 bit - H.264/MPEG-4 AVC codec Using same video/CRF values, etc. the 8bit produced 5980kbps video filesize 5.3MB, vs: 10bit 5093kbps filesize: 4.5MB.. my eyes are not good enough to tell the difference So will use the 10-bit for now.. hopefully that is compatible enough for the long term... This is not 'urgent', just something to figure out at one point or another Stormy. |
|
20th November 2018, 09:44 | #16 | Link |
Registered User
Join Date: Mar 2011
Posts: 4,823
|
For x264 I'd stick with 8 bit unless you really need 10 bit. Everything will play 8 bit AVC, but there's not much support for 10 bit outside of the PC and probably never will be. You'll be encoding your video in a format hardware players don't support.
I haven't followed this thread much, aside from noting the drag and drop nature of VD2 and how quickly easily you're encoding your video (sorry, but I couldn't help myself, I'm only human ) Have you tried manually extracting the mp3 audio from the source and adding it to the output file yourself? Unless you're editing? I can't be of much help as normally I'd remux a MOV file as MKV before re-encoding it, and extract the audio myself. MKVToolNixGUI makes working with MKVs pretty easy and programs such as gMKVExtractGUI and MKVCleaver (and MeGUI) can extract streams from MKVs. Working with MP4s does my head in, and trying to mux with MP4Box destroys my will to live. Can you use Std In with direct stream copy? I wouldn't have thought so, but I don't know much about VD. Maybe that's why you suspect the output is really a wave file? -y -i - -codec copy -f mp3 "%(tempaudiofile)" Anyway, why not extract the audio yourself first, if you're not doing so already? ffmpeg.exe -i "source.mov" -vn -acodec copy -sn "audio.mp3" That should be something like a command line for extracting it with ffmpeg outside of VD2. Once you have the MP3 audio extracted, add it via the Audio Menu while making sure MP3 is selected as the input file type. I think that should ensure Direct Stream Copy works it won't be decoded by ffmpeg. To get VD2 to mux it with the encoded video..... unfortunately I've no idea how that works. Last edited by hello_hello; 20th November 2018 at 12:15. |
20th November 2018, 10:24 | #17 | Link |
Registered User
Join Date: Jul 2002
Posts: 241
|
Hello_Hello,
You are human and very good at it!! Funny comments, enjoyed every joke Honestly, I did not anticipate it being so complex, but starting to enjoy the puzzle aspect of this very much and the supporting energies Thanks for the tip on the 10bit!!! Immediately ABORTED the encodes, and restarted with 8bits!! so many speed bumps and trap doors - need a Scooby Doo As for my sources, the MOV file has NO audio, the audio is a separate mp3 pre-encoded, just need to Mux it (without re-encoding the mp3) into an mp4 container, but your remarks on mp4box are not very encouraging... so you're trying to convert me to MKV, i love that format, but for now i'll stick with the "herd" (mp4 or avi) so it is less 'scary' to others. Until this external-encoder audio-passthrough is sorted out using the internal one (8bit of course!!!). Thanks for the education, and feel FREE to joke around, that is very well received - maybe I'll do a video on it one day Stormy. |
20th November 2018, 10:42 | #18 | Link | |
Registered User
Join Date: Mar 2015
Posts: 775
|
Quote:
Your profiles look ok. I must say direct-copy with external profiles is darkest shade of grey area. Checklist of what is required: 1. copy-compatible source (e.g. internal avi, mpeg audio) Nowhere in the ui you can see what is the format of current audio. Try to show audio display and if it says "audio is compressed" then maybe it is mp3. 2. audio mode set to direct-copy 3. audio encoder set to not bypass compression (when I said this is intuitive I was joking) Maybe there is something else. Try using ffmpeg muxer instead of mp4box, maybe it will tell something different.
__________________
VirtualDub2 |
|
20th November 2018, 11:27 | #19 | Link | |
Registered User
Join Date: Jul 2002
Posts: 241
|
Ah, should've picked up on the sarcasm with regards to intuitive, just shows how seriously i take your words
In my case the audio stream is well known, and 100% mp3 format as a separate file. Took both of your offers, and tried MKV, downloaded v28.2, added this: Code:
"AVC [Film] (10bit)MKVpass": { "videoEncoder": "V AVC [Film] (10bit)x264", "audioEncoder": "A Passthrough", "multiplexer": "M MKVMerge", "description": "*.mkv", "extension": "mkv", "processPartial": false, "useOutputAsTemp": false }, Code:
"M MKVMerge": { "name": "M MKVMerge", "program": "c:\\Programs\\VTools\\mkvtoolnix\\mkvmerge.exe", "commandArguments": "-o \"%(outputname)\" --default-duration 0:%(fpsnum)/%(fpsden)fps \"%(tempvideofile)\" \"%(tempaudiofile)\" ", "outputFilename": "", "type": 2, "pixelFormat": "", "inputFormat": 0, "checkReturnCode": true, "logStdout": true, "logStderr": true, "bypassCompression": false, "predeleteOutputFile": true }, As for seeing the format of audio, you would know better than me on that.. however, noticed that selecting VD2-> File -> Save Audio... opens a dialog to enter filename, on the bottom, there is a readonly field "Compression:" In the resulting MKV file (with supposed Audio Passthrough), it says No compression (PCM), and in the case where a true MP3 is attached, it shows "(Stream Copy)"... Also, the Saved audio (from the mkv) plays ok, but file info says it is PCM. If you have time, take a larger clip/mp3, like 10minutes or so, then u'll see SIZE differences, that's how i noticed in the first place, since the source mp3 are ~5mb, but final audio in mp4 was more than 10 times in size, that does not make sense... Quote:
Stormy. Last edited by stormy1777; 20th November 2018 at 12:16. Reason: typo in xml |
|
20th November 2018, 11:44 | #20 | Link |
Registered User
Join Date: Mar 2015
Posts: 775
|
> Where is that option hiding?
Main menu->View->Audio display atm this is mostly useful with caching input driver but as I said it has side effect of telling "compressed". When you open the newly created file in VD2 you can go to Main menu->File->Information, there you can see audio format as stored in the file (should be "mp3"). Don't know why it still does not work for you. Can you save temp audio file and inspect it? There is no obvious way to grab it, you need something like muxer command that will simply copy the audio file as is (this could be some generic file utility, pkzip for example).
__________________
VirtualDub2 |
Thread Tools | Search this Thread |
Display Modes | |
|
|