Log in

View Full Version : VD2 External Encoder questions


Pages : [1] 2

stormy1777
14th November 2018, 20:44
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:

---------------------------
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.

shekh
18th November 2018, 04:10
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.

sneaker_ger
18th November 2018, 12:18
1) tried setting "Audio encoder" to NONE in the edit external encoder SET. that failed during encoding audio.
Post the complete VirtualDub log. For me such things work fine. You did create a muxer setting with only video, right?

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.

stormy1777
18th November 2018, 18:52
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.php?p=1857369#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:

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

it is almost I need something like "cat sound.mp3" just pass the audio onwards, and let the muxer add to the video.

If you have a sample working that would be great, since all my audio is already encoded at source.

Stormy.

sneaker_ger
18th November 2018, 20:06
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 was talking about 2 different issues.

it is almost I need something like "cat sound.mp3" just pass the audio onwards, and let the muxer add to the video.
The biggest problem is passing through the mp3 (or whatever) data still compressed. Again: the input filter/"driver" is important. Still haven't told us about your source format and input driver.


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.

stormy1777
18th November 2018, 22:57
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 :)



The biggest problem is passing through the mp3 (or whatever) data still compressed. Again: the input filter/"driver" is important. Still haven't told us about your source format and input driver.

Very simple, DSLR produces MOV (quick time) videos, NO audio is recorded, that is added from a pre-compressed .mp3 or whatever.

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..


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.


The mp3 file is 3MB in size, I can't think of anything 'crazy' , at least knowingly that I'm trying to do :)
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:

---------------------------
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:

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)

and then few seconds later it fails with this error:

[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

tail of the log shows what the user is getting on the pop up:

[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.

sneaker_ger
18th November 2018, 23:28
[i] AudioEnc: [NULL @ 006358c0] Unable to find a suitable output format for 'M:\temp\test.mp4.audio'
With "-codec copy" ffmpeg knows it should keep mp3 codec from input but it is unable to determine a suitable container because you haven't explicitly specified "-f mp3" and it can't guess from the ".audio" file name. (Maybe it makes sense to choose a container that supports all your audio formats, e.g. "-f matroska". You're remuxing anyways.)

stormy1777
19th November 2018, 09:10
OK!! some PROGRESS!!!!

Now the "audio encoder" called "Audio passthrough" looks like this (running ffmpeg):

-y -i - -codec copy -f mp3 "%(tempaudiofile)"

it ran through to completion, and produced a smaller overall MP4 file, say 160MB vs. 270MB (without the passthrough audio)... However I don't think we're there yet.

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.

sneaker_ger
19th November 2018, 15:11
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.

stormy1777
19th November 2018, 18:07
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.

gspot is very reliable for AVI containers, it loses track with MP4 containers, so that is not an option, hence tried the various mp4 explorers, but could not get the Audio stream size...

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.

sneaker_ger
19th November 2018, 18:27
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").

shekh
19th November 2018, 18:30
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).

stormy1777
19th November 2018, 20:06
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

shekh
19th November 2018, 20:56
Tried and it works.

This command is ok:

-y -i - -codec copy -f mp3 "%(tempaudiofile)"


Profile option "Bypass compression" must be unchecked!
Otherwise the audio is decoded by internal mp3 decoder.

Yeah, intuitive :)

stormy1777
20th November 2018, 09:38
Tried and it works.

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?


This command is ok:

-y -i - -codec copy -f mp3 "%(tempaudiofile)"


Profile option "Bypass compression" must be unchecked!


Yes, this is what I got setup since '-f mp3' was mentioned the other day; as fpr the "bypass compression", was not aware of that screen, it was/is unchecked, however, not sure i agree with "intuitive" :) I would think it SHOULD be checked, to "bypass" compression, and send it as-is, tried it checked; it fails on an anonymous pipe failure, so leaving unchecked for now :)

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:

"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
},


and, this is the duplicated entry, just change the Audio to the "A passthrough" encoder:

"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
}


In above, the video, and multiplexer are the SAME, just audio changes.

The "A passthrough" is defined as follows:

"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
},


For completeness, the mp4box muxer is defined:

"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
},


Doing a TEST clip with a small SELECTION (that is 10 seconds from the whole 5 min clip), produced a video withOUT any audio at all... When doing the normal audio processing the video has audio..

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.

hello_hello
20th November 2018, 09:44
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 (https://forum.doom9.org/showthread.php?p=1857835#post1857835), 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.

stormy1777
20th November 2018, 10:24
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.

shekh
20th November 2018, 10:42
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?


Works: direct-copy audio through external encoder process. I did not follow mp4 manipulation, for my test I muxed into mkv with ffmpeg and I'm quite sure the resulted audio is mp3 otherwise it would not decode.
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.

stormy1777
20th November 2018, 11:27
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:

"AVC [Film] (10bit)MKVpass": {
"videoEncoder": "V AVC [Film] (10bit)x264",
"audioEncoder": "A Passthrough",
"multiplexer": "M MKVMerge",
"description": "*.mkv",
"extension": "mkv",
"processPartial": false,
"useOutputAsTemp": false
},

and this:

"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
},


Got an MKV, audio/video play OK, however, I think the Audio is *PCM* and NOT mp3...

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...

Try to show audio display and if it says "audio is compressed" then maybe it is mp3.

Where is that option hiding?

Stormy.

shekh
20th November 2018, 11:44
> 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).

stormy1777
20th November 2018, 12:28
Oh, wow, never saw that option before!!! OK, then that confirms what I'm trying to say!!

On the original source (test.MOV + test.mp3) the audio display says "track is compressed" (meaning, it's a true mp3 source file).

However, after the passthrough external encoding, VD2 does show a graph for the audio, which says that audio in the mkv/mp4 was EXPANDED....

As written before, this reminds me older issues with virtualdub, like this:

https://sourceforge.net/p/vdfiltermod/tickets/105/

where direct stream/audio of a source mp3 produced a WAV/PCM audio stream!!

So, decided to try the other two audio input drivers (Caching input driver, and ffmpeg), both failed on the final mux (mkv):

---------------------------
VirtualDub Error
---------------------------
CLI: The audio encoding process failed with error code 1 (00000001). Check the log for possible error messages.
---------------------------
OK
---------------------------

in the log it says:

AudioEnc: pipe:: Invalid data found when processing input

As soon as the audio stream is opened using the "MPEG audio input driver (internal)"[b] these failures stop - this is probably by design, but wanted to rule out the input drivers;

However, the resulting mkv has a [b]PCM stream inside it as confirmed by various methods...including VD2 showing a nice audio graph for it :)


Wait, you are saying that you got an MKV with a compressed mp3 inside it using external encoder? any chance u can PM or otherwise send your External encoder XML file?

I'm using absolutely latest version from all these components, maybe you are not?

Thanks...
Stormy.

hello_hello
20th November 2018, 12:31
If you're not editing, it'd probably be easier to mux the audio yourself than to get VD2 to do it, if Direct Stream Copy isn't working for you.

Tell VD2 to only output the video stream and not to do any muxing. A 264 stream will do, but it's more fun with x264 writing directly to MKV, because then you can open and preview the output video with MPC-HC, and probably other players, while it's still being encoded. I think you just need to specify mkv as the output extension for the encoder. Something like %(outputname).mkv

When it's finished, open the output with MKVToolNixGUI, add the MP3 audio and mux.
For the MKV you have with PCM audio, disable the PCM stream after opening it with MKVToolNixGUI, add the MP3 audio and mux.

By the way, if you want to create an MP4 yourself, MeGUI has an MP4 muxer under the Tools menu. It uses MP4Box to do the work and creates the appropriate command line so you don't have to worry about it, but if you want to see the command line MeGUI used, it'll be in the log file.

stormy1777
20th November 2018, 12:45
Thanks Hello^2,

You'll love this part:

I do basic edit from start/end, then "sync" the audio Ctrl-I, "audio skew correction", once all is right, press F7 to SAVE, and that DID the right job, only "issue" is it uses a slightly "older" x264 codec, and produces an AVI vs. mp4/mkv containers.. both of these issues may not be a factor compared to the alternatives :)

It may not sound like it, but this is NOT my day job, it is just a hobby, and need to process a few of these file/combos a day, batch is not possible, b/c the "human eye" must "see" what is going on, match video/audio, etc. also, working with multiple files/tools can easily MIX up the audio/video.. so, best for my own sake to keep it in ONE tool :)

Tried the VD2 jobs, but that too has an issue b/c it closes the whole thing, so must remember to save each thing as a separate project before submitting the job..

Anyways, one day I'm sure we'll figure it, until then, I'm on F7/x264-internal to VD2 and, living happily with a slightly "older" codec with AVI containers and mp3 inside them :)

Thanks for the help, MeGUI was over the top for me, I'm an old dog, so will stick to VD2 for now :)

Stormy.

hello_hello
20th November 2018, 14:46
I'd consider remuxing the AVIs as MP4 or MKV. I'm not sure how common hardware player support for AVC in an AVI would be.

Did you sort out your problem with dark scenes not encoding well?

stormy1777
20th November 2018, 16:09
Re-muxing?? nooooo..... i get one pass (hopefully with one tool) at these, and the next day, more come, every once in a while I stop/pause and re-org things (like these past few days), for now it'll be AVI/AVC, until which time we can figure how to do external encoding without re-encoding audio, which was the original goal of this thread :)

Regarding dark scene, it happens with extremely bright scenes too, not fast moving at all, the visual is "grading" of the dark/bright areas.. i'm no video expert, but maybe u just need to give it more "bits" which results in higher file sizes, because the source colors are not "constant" they are "shades" of bright/dark (like clouds).. I did switch to Slower profile and Film, and lowered CRF to 14, so, lets see how that plays out in the coming weeks :) If I get time i may post that other thread...

Thanks Hello_hello, noticed u'r almost 4000 posts!! that's impressive!! keep up!

If anyone can mux mp3 into mkv or mp4 without re-encoding using VD2 external encoder, speak up :) :) i.e. post your xml config or give some clues :)

Stormy.

hello_hello
20th November 2018, 17:16
You'll have to venture into Avisynth territory to use it, but I add GradFun3() (http://avisynth.nl/index.php/Dither_tools#GradFun3) to the end of every script. It dithers to help prevent banding when encoding in 8 bit, especially after applying a noise removal filter, and it'd probably help with the problem you described, but I'm guessing without being able to see a sample of the source. I've no idea if there's a similar VirtualDub plugin.

Very occasionally I have to encode a section of a source with a lower CRF value, but mostly GradFun3() is enough. When I need to though, I generally split out the problem section from the rest of the encoded video with MKVToolNixGUI, encode just that section again at a lower CRF value (have I mentioned the AVS cutter? ;)), then append the parts with MKVToolNixGUI. I always add -stitchable to the x264 command line so splitting and appending encodes won't be a problem, should I need to do it. Of course, that sort of thing can be quite time consuming.

stormy1777
20th November 2018, 17:37
You are scary.. why reveal the existence of such ruthless tools?.. it is very tempting now... that GradFun3 (wonder what ever happened to 1 and two :) :) has many parameters, how do you use it? or is there some "sane" default or does one need another tool or another PhD in something ? Avisynth is somewhat doable, just for the video opening, rest i think can be done in the GUI..

Also, i never know whats the best/correct way to open the MOV/Quicktime video file itself, there are DirectShow and other means, but maybe we should move to the other thread, and keep this one for the External encoding effort :)

I may be getting a newer camera body (current one is almost 8 years old!!), so the format might change again :) :) more fun stuff...

hello_hello
21st November 2018, 00:30
You are scary.. why reveal the existence of such ruthless tools?.. it is very tempting now... that GradFun3 (wonder what ever happened to 1 and two :) :) has many parameters, how do you use it? or is there some "sane" default or does one need another tool or another PhD in something ? Avisynth is somewhat doable, just for the video opening, rest i think can be done in the GUI..

Also, i never know whats the best/correct way to open the MOV/Quicktime video file itself, there are DirectShow and other means, but maybe we should move to the other thread, and keep this one for the External encoding effort

Avisynth plugins and functions mostly have default values for their options, so GradFun3() in a script uses the default values, which is what I use 99% of time. As an example, GradFun3(thr=0.35) is the same as GradFun3(), as the threshold default is 0.35.

When you open a file with MeGUI's File Indexer, it defaults to what's generally the best indexer for the source, so it's just a matter of adding the indexing job to the queue and running it. For MOV files I assume it indexes with Lsmash. When the indexing has finished it'll create the appropriate script for opening the video and then open it with the Script Creator.
When you first use MeGUI it'll probably do a lot of updating and/or installing of the components it uses. You can get that out of the way by opening the updater under the Options menu. Check the "show all packages" option and if any tools are shown as disabled, right click on each one to enable them. When that's done, click the Update button.

DirectShow is generally a last resort method as it's not frame accurate and the decoding is beyond MeGUI's control. It's disabled by default. When it's enabled, you have to open a source directly with the Script Creator for MeGUI to offer it as a choice.

shekh
21st November 2018, 11:53
Here settings that work for me, using only ffmpeg.exe (not mkvmege.exe, x264.exe - haven't tried)
vdproject does not have anything special but including it just in case. Replace music.mp3 with something that you have and you are ready to export.

https://gist.github.com/shekh/55c7907e14d290243b3f3a498fdcbb7c

stormy1777
21st November 2018, 17:52
shekh,

I'm in traveling mode, but will surely look into it shortly!! Thanks so much, I've already pulled the bits but will need time to put it together...

hello^2,
Hope you're OK with the ^2 shortcut :) it was funtime "right-clicking" all these modules in MeGUI, I guess they couldn't think of a single button or select all or shift or something like that, anyways, that whole interface looks a bit daunting and scary.. maybe one day it'll grow on me :) :)

Stormy.

shekh
22nd November 2018, 01:11
Surprisingly I found no problem doing the same task with vd2 itself.
x264: use plugin codec (x264 8-bit)
muxing to mp4 or mkv: use plugin format in regular "Save As" dialog

In this experiment the MPEG audio decoder was operating in VBR mode, I suspect the procedure will not work otherwise (FFMpeg muxers want complete audio packets whereas CBR mode assumes the receiving end can eat arbitrary bytes).

stormy1777
23rd November 2018, 13:47
Surprisingly I found no problem doing the same task with vd2 itself.
x264: use plugin codec (x264 8-bit)
muxing to mp4 or mkv: use plugin format in regular "Save As" dialog



Very interesting!! amazed to see VD2 has this capability; HOWEVER, tested, and we're back to square one at the start of this thread :)

Why? Because the Audio stream appears to be fully expanded and muxed, even though 'direct copy stream' is selected, which is why i was asking if mp3 can "live" still compressed in mp4 container, I suspect it can, but VD2 does not do it (yet) :) ?

This is my lack of knowledge on all these formats/containers, saved as .MOV and .MP4, both came to same size, and inside "File Information" both show as "QuickTime / MOV" for the "Container Format", strange, I would expect MOV to be Apple/Quicktime/MOV, and MP4 to be mp4/MPEG, but i guess these are somewhat related, or especially like that to confuse me :)

In any event, also saved as MKV, and again, the audio appears to be in PCM and 10 times larger in size!!

Verifying that by "File->Save Audio", on bottom it has "Compression" field, and that shows as "No compression (PCM)", as opposed to "copy stream" when it is compressed mp3. Also, the View->Display Audio shows the graph, which means the audio is fully expanded....

I'll try the external path you posted earlier, but clearly if this can be done within the VD2 framework, that would be a huge time saver!!

Stormy.

shekh
23rd November 2018, 15:22
It seems we make circles around the same thing: "1. copy-compatible source (e.g. internal avi, mpeg audio)"
Note the line in the project I shared above:

VirtualDub.audio.SetSource("music.mp3", "MPEG audio input driver (internal)", "DAAAAE1QM08AAAAA");


Quicktime and mp4 are closely related, afaik "QuickTime / MOV" is the name of format parser in ffmpeg rather than accurate identification of format itself, and since tha same parser can read a group of similar formats you see this name.

stormy1777
23rd November 2018, 15:52
Tried your script but it refers to some test driver?

VirtualDub.Open("","Test video input driver (internal)",0,"AQA=");
VirtualDub.audio.SetSource("music.mp3", "MPEG audio input driver (internal)", "DAAAAE1QM08AAAAA");

gives an error about input driver...

I've changed it to:

VirtualDub.Open("$(PROJECT)\\test.MOV","",0);
VirtualDub.audio.SetSource("$(PROJECT)\\test.mp3", "MPEG audio input driver (internal)", "DAAAAE1QM08AAAAA");


and it then opens video file OK, however, again, saving F7 , audio set to direct-copy-stream, appears to expand the audio.


I have not yet tested the External encoding route, also tried within VD2 directly, so:

* open video file: test.mov using: caching input driver
* open Audio from file, input driver: MPEG audio input driver (internal)

ctrl-p set x264 8bit video compression, CRF=16.

audio set "Direct copy stream", and then F7 to save in various containers, the audio in this case in the resulting saved file appears uncompressed PCM. Choosing an AVI container produces "expected results" with a compressed mp3 file..

It may turn out to be a "representation issue", where by the audio is mp3 even in the MOV/MP4/MKV case, but somehow there is a PCM "header" which tells it how to filter the audio... since file sizes seem to be similar.. but no easy way to know how much audio is taking other than exporting it, then u end up with a huge file, compared to the AVI container case.

Stormy.

stormy1777
23rd November 2018, 16:06
I'll try few more tries, if you/someone can confirm that after muxing an mp3 (direct copy stream), the resulting MOV/MKV/MP4 containers now hold a file which, when opened in VD2 shows as compressed audio, i.e. View->Display audio does not show a graph, and the File-Save Audio shows "(Stream copy)" and not PCM. If you can confirm that this works on your end, then I'll try other PCs or re-start from scratch (new Virtual Dub directory).. maybe all these plugins are causing it to get confused :)

stormy1777
23rd November 2018, 16:47
Oh, so sorry, I had a typo, your vdproject does work, it opens a test 3d box, but really i don't see how that is changing anything, still F7/save, results in container (mp4/mov/mkv) with an apparent expanded mp3 (PCM) audio, vs. the original file which is mp3, that does not happen when in AVI container, but again, maybe it is just the way things are, although extremely confusing for us (normal people)

shekh
23rd November 2018, 16:59
So, with everything setup and only changing output container, you get compressed mp3 in AVI but uncompressed pcm in mp4?
This is hard to understand.
Unfortunately VD does have code to uncompress mp3 and some obscure logic to trigger this. It is definitely connected to audio mode (direct/full) but maybe something else (not yet identified).

stormy1777
23rd November 2018, 17:14
I'm going by what I know and see.. File-Save Audio in the resulting mkv/mov/mp4 results in a LARGE PCM/WAV file, whereas the same operation on the saved AVI results in an MP3 file. if you/anyone gets other results, let me know...

shekh
23rd November 2018, 18:23
So you are doing:

1. convert test.mov+test.mp3 to new.mp4 -> success
2. convert new.mp4 to new2.wav -> fail

Why you don't see these are similar and unconnected operations.
You can begin right from #2, get some mp4 and try to extract mp3 from it. You still have to use direct-copy enabled driver as mentioned several times. "Caching input driver" does not support this yet.

stormy1777
23rd November 2018, 21:52
Right:

1) Mux test.mov (which has no audio stream at all) + test.mp3 >> test.mp4 all good.

2) attempt to EXTRACT mp3 from test.mp4 -> strange results...

I thought the focus was on the AUDIO input driver on the Open audio from file stage in step#1, but now i see the input driver of step#2 for the saved *VIDEO* open is critical..

OK for step#2, with Caching input driver, indeed all containers (except avi), produce a large WAV/PCM exported audio file, so clearly not the original mp3.

Tried with Quicktime input driver for step#2, and exporting the audio (via: file->Save Audio, OR: Export-> Raw Audio) yields a 1MB (1 minute) file whereas original is 4 minutes (roughly 4MB) :) I got no marker points on the video, playing it in VD2 plays the whole 4min, playing the extracted audio, indeed just 1 minute of audio is saved :) the original audio/video are about 4min long.

Tried with FFMPeg input driver for step#2, but exporting audio as above gets the PCM/fully expanded audio.. I assume it is just "working" on your end :)

Stormy.

shekh
23rd November 2018, 23:59
Tried to extract mp3 with quicktime.vdplugin from 28min movie:
extract raw audio -> 28 min
save audio to wav -> 28 min
save audio to mp3 -> 16 min
But the file sizes are all nearly equal and "16 min" is interpreted only by ffmpeg (looks like error in header which is ignored by other programs)
There are smaller issues like different initial offset but overall the extracted mp3 looks normal.

> Tried with FFMPeg input driver for step#2, but exporting audio as above gets the PCM/fully expanded audio

This driver also does not support direct copy.

stormy1777
24th November 2018, 08:29
Ok, so this looks like there IS some sort of a "bug" in the save as (mp3).. in the MOV/MKV/MP4 containers, where by the resulting .mp3 is only fraction of the full length of the clip!!

The workaround, is save audio as.. ".wav", that gets you correct length, and file format shows: "Format: Lame MP3, 102 Kbit/se, 44.100 Hz, Stereo" (but extention is .WAV not .MP3 :), renaming that .wav to .mp3 and again, clip becomes significantly shorter. File info (of the mp3) shows "MPEG 1.0 layer 1, 448kbit, 32000Hz, Joint Stereo"

All that with the quicktime input driver and on the Save Audio, with FFMPEG or "All files" enter filename with .mp3 extension.

I think with AVI containers it is more "forgiving" except sometimes it complains about VBR audio and out of sync...

Anyways, the "requirement" (desire) is very simple, be able to compress MOV and mux with existing MP3, then, at a later time, extract that MP3 and get more or less the original file put there, funny that in this digital world, so much fluidity is introduced, I was naively thinking the same mp3 will pop out :) :)

I'll continue to try and find the best container/input drivers for this.. Thanks everyone!! sorry for going back and forth so many times, at this point I got the picture a lot better, there are many factors, and "loose ends" so to speak, so I'll need to find what "works for me" until such future time when all bugs will be fixed :) :) :) :) :) :)

Stormy.

hello_hello
25th November 2018, 10:14
I had a play as it seemed like I might learn somthing along the way....
Muxing a stand-alone mp3 stream into an MP4 appears to be working for me. It didn't seem to matter if "-f mp3" was in the command line or not. The VD2 "bypass compression" option does need to be unchecked in the audio encoder setup (which seems counter-intuitive to me). The ffmpeg audio encoder command line. -report included to check what ffmpeg is doing.

Command Line: -report -y -i - -acodec copy -f mp3 "%(tempaudiofile)"
Output Fie Name: %(outputbasename).mp3

This is another way of doing the same thing.

Command Line: -report -y -i pipe:0 -acodec copy "%(tempaudiofile)"
Output Fie Name: %(outputbasename).mp3

stormy1777,
as I don't use VD much I didn't pay enough attention earlier, but after some reflection I'm sure the problems you were experiencing originally were due to using the following as an output file name.
%(outputname).audio

I think that would've caused ffmpeg to try to find an output codec that would normally have an .audio extension, or output an mp3 with that extension (with -f mp3 in the command line). It appears to have complained about that earlier.

"Unable to find a suitable output format for 'M:\temp\test.mp4.audio"

It's mentioned again in one of the ffmpeg log files you posted.

"AudioEnc: M:\temp\test.mp4.audio: Invalid argument"

%(outputbasename).audio.mp3
as the audio output file name would work. If the final output name was video.mp4, the audio from ffmpeg would be "video.mp4.audio.mp3"

%(outputbasename) doesn't include an extension so you do have to append .mp3 to it, but whatever works, it just needs to have an mp3 extension.

This was my MP4Box command line.
Including name= prevents MP4Box from using the default fugly track titles.
fps=%(fps) didn't seem to be required, but it probably doesn't hurt.

-add "%(tempvideofile):fps=%(fps):name=" -add "%(tempaudiofile):name=" -new "%(outputname)"

For x264 (I can't remember if it's all needed to make VD work. It was just an old preset I created years ago when I was playing around):

Command Line:
--demuxer raw --input-csp i420 --input-res %(width)x%(height) --fps %(fpsnum)/%(fpsden) -o "%(tempvideofile)" -
Output Fie Name:
%(outputname).264

I opened the mp3 with the internal VD2 mpeg audio decoder. I read something regarding editing in another thread, but when I tried some quick editing it worked as expected (as though the audio had been part of an opened video file).

I'm not sure why MediaInfo says the audio is constant bitrate, then shows a maximum bitrate that's higher. Probably just how MediaInfo interprets an MP4 quirk. The source MP3 was 192kbps CBR.
(the x264 version is a bit old, only because it's the one I copied to a VD "encoders" folder years ago)

Complete name : D:\test.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/avc1)
File size : 16.6 MiB
Duration : 2 min 19 s
Overall bit rate : 996 kb/s
Encoded date : UTC 2018-11-25 08:29:31
Tagged date : UTC 2018-11-25 08:29:31

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, RefFrames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 2 min 19 s
Bit rate : 800 kb/s
Maximum bit rate : 2 700 kb/s
Width : 720 pixels
Height : 480 pixels
Display aspect ratio : 3:2
Frame rate mode : Constant
Frame rate : 29.970 (30000/1001) FPS
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.077
Stream size : 13.3 MiB (80%)
Writing library : x264 core 144 r2525 40bb568
Encoding settings : removed to save space
Encoded date : UTC 2018-11-25 08:29:31
Tagged date : UTC 2018-11-25 08:29:32
Codec configuration box : avcC

Audio
ID : 2
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Codec ID : .mp3
Duration : 2 min 19 s
Bit rate mode : Constant
Bit rate : 192 kb/s
Maximum bit rate : 201 kb/s
Channel(s) : 2 channels
Sampling rate : 44.1 kHz
Frame rate : 38.281 FPS (1152 SPF)
Compression mode : Lossy
Stream size : 3.20 MiB (19%)
Encoded date : UTC 2018-11-25 08:29:31
Tagged date : UTC 2018-11-25 08:29:32

stormy1777
25th November 2018, 11:38
Thanks Hello*2...

The error:

AudioEnc: M:\temp\test.mp4.audio: Invalid argument

was before the "-f mp3", as soon as it was added, the encode worked, and again, I can now easily mp3 into MKV/MP4 containers, the only issue is when attempting to extract the audio track. The source file may be 5MB 192kbp/s and save audio/export raw audio may yield a 40MB file!!!

That is the main issue, with external encoding or with internal VD2 encoding, same symptom happens.. not so much with AVI containers, where i can mostly extract the MP3 and get same size as original source mp3.

On that topic, is there a tool that can show how much space the AUDIO section of an MP4 consumes, vs. how much VIDEO? Tried all the mp4 explorers, they produce a LOT of data/graphical, etc. but could not figure the fields that denote the actual total space for AUDIO vs. VIDEO. That is extremely easy to obtain in AVI containers using gspot and similar tools.

Thanks.

Stormy

hello_hello
25th November 2018, 12:33
On that topic, is there a tool that can show how much space the AUDIO section of an MP4 consumes, vs. how much VIDEO? Tried all the mp4 explorers, they produce a LOT of data/graphical, etc. but could not figure the fields that denote the actual total space for AUDIO vs. VIDEO. That is extremely easy to obtain in AVI containers using gspot and similar tools.

You haven't use MediaInfo? Download the appropriate GUI version "without installer" as there's no adware to worry about. Just unzip it. When you open a file for the first time, you're usually offered a setup dialogue for adding an Explorer extension and choosing a default view. I use HTML view myself. They're probably the only to things you need to change, if you want to.
https://mediaarea.net/en/MediaInfo/Download/Windows

From the MediaInfo report I posted above.

Stream size : 3.20 MiB (19%)

I must have missed where you got the external encoders feature working.

For extracting from MP4.....
MP4Box would no doubt do it, but I've no idea what the command line would be. I'd tend to use ffmpeg. I have quite a few ffmpeg presets setup in AnotherGUI (https://www.videohelp.com/software/AnotherGUI) because I'm too lazy to use the command line directly and AnotherGUI will run jobs in batches. A preset for extracting MP3 from anything would look like this.

-i "<FullSourceFileName>" -y -threads 1 -vn -acodec copy -sn "<OutputPath><OutputFileName>.mp3"

If it's not extracted as an MP3 then it wasn't MP3 audio, although chances are you'd get an error instead

The way I read it, Box4 (https://www.videohelp.com/software/BOX4) says it accepts MP4/MOV as input and outputs mp3 by copying. I've never used it.

I ran a few quick test using the quicktime input driver to open an mp4 and then "File/Export/Raw Audio" to extract it. So far it seems to be fine. If you mux a video with an MP3 and the video duration is shorter than the audio, many muxing programs would cut the audio where the video ends. MP4Box does, at least be default, so obviously the MP3 coming out won't be the same size as it was originally.

stormy1777
25th November 2018, 20:53
Oh dear, I had a really nice reply Hello*Hello, but got:

Your submission could not be processed because the token has expired.

then hit BACK arrow on the FF browser, but all text is gone :) not sure if this is a function of the forum (I think so) or my client browser (doesn't happen in other boards when it times out).

In any event, probably should wrap up this thread soon.. since I'm no longer using External Encoders, just doing it directly inside VD2's F7/Save as...

The MediaInfo is a LIFESAVER, I was only aware of gspot :( a bit dated I guess :) :)

AnotherGUI is really a miracle tool!!! thankfully someone invented it, and you made us all aware!! So, indeed it managed to extract most mp3 fine, except a few (maybe ones that were encoded using external tools) got this error:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Y:\test.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1
creation_time : 2018-11-18T22:43:07.000000Z
Duration: 00:03:53.36, start: 0.000000, bitrate: 8884 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720,
8689 kb/s, 128 fps, 128 tbr, 128k tbn, 256 tbc (default)
Metadata:
creation_time : 2018-11-18T22:43:07.000000Z
handler_name : mp4.Video.x264@GPAC0.7.0-rev0-gbd5c9af-master
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 184 kb/s (default)
Metadata:
creation_time : 2018-11-18T22:12:39.000000Z
[mp3 @ 0254d680] Invalid audio stream. Exactly one MP3 audio stream is required.

Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Last message repeated 1 times

MediaInfo for that exact file:


Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.2
Format settings : CABAC / 8 Ref Frames
Format settings, CABAC : Yes
Format settings, RefFrames : 8 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 3 min 53 s
Bit rate : 8 689 kb/s
Maximum bit rate : 9 423 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 128.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.074
Stream size : 242 MiB (98%)
Title : mp4.Video.x264@GPAC0.7.0-rev0-gbd5c9af-master
Writing library : x264 core 157 r2935 545de2f
Encoding settings : cabac=1 / ref=8 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=16.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 2018-11-18 22:43:07
Tagged date : UTC 2018-11-18 22:43:21
Codec configuration box : avcC

Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 3 min 53 s
Bit rate mode : Variable
Bit rate : 184 kb/s
Maximum bit rate : 219 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 5.12 MiB (2%)
Encoded date : UTC 2018-11-18 22:12:39
Tagged date : UTC 2018-11-18 22:43:21

Ok, fine, whatever, maybe that audio is somehow muxed incorrectly, so naively thought to myself, that should be super SIMPLE to resolve, VD2 open video, open same audio (original mp3), set BOTH to 'direct stream copy' and just SAVE to new video file..

Input Driver is the key here it seems, so after several failures narrowed it down to the VIDEO Input Driver...

opened *LATEST* VD2 build 43073 (which adds support to not lose project once a JOB is submitted!!!)

First tried "Caching input driver", set Audio to "NO AUDIO", and save failed with:

---------------------------
VirtualDub Error
---------------------------
Direct stream copy cannot be used with this video stream.
You may want to select different Input Driver.
---------------------------
OK
---------------------------


Next, tried Quicktime input driver, it failed with:

---------------------------
VirtualDub Error
---------------------------
none: codec not currently supported in container mp4
---------------------------
OK
---------------------------



Just for kicks, tried "ffmpeg" as the input driver on the original OPEN of the mp4, and SAVE/f7 failed with:

---------------------------
VirtualDub Error
---------------------------
Direct stream copy cannot be used with this video stream.
You may want to select different Input Driver.
---------------------------
OK
---------------------------



I don't ever recall having any such issues with AVI containers.. is there any magic here to allow direct copy stream in this mp4 container, or somehow to fix these "headers"... I have the original mp3 but cannot seem to mux it into the existing video...

Thanks,
Stormy.

shekh
26th November 2018, 00:07
Direct-copy for video is somewhat more involved compared to audio.

> none: codec not currently supported in container mp4

Looks like there is incompatibility across plugins. In quicktime driver you can override tag AVC1->H264 and then it works
https://i.postimg.cc/G3ZDRcSt/quicktime.png

stormy1777
26th November 2018, 07:02
wow, impressive, and interesting the flexibility builtin so many years ago :) Yes, it DID save the MP4... HOWEVER... the resulting mp4, opened in a new VD2 instance, using QuickTime I/D (input driver) resulted in two black windows saying "NO VIDEO".. The video does play ok in VLC, but in BSPlayer only the AUDIO plays, without any window for video :)

This is the video info of the SAVED mp4 file:

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.2
Format settings : CABAC / 8 Ref Frames
Format settings, CABAC : Yes
Format settings, RefFrames : 8 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 3 min 53 s
Bit rate : 8 689 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 128.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.074
Stream size : 242 MiB (98%)
Writing library : x264 core 157 r2935 545de2f
Encoding settings : cabac=1 / ref=8 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.15 /
mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=6 /
lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 /
b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 /
rc_lookahead=60 / rc=crf / mbtree=1 / crf=16.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Codec configuration box : avcC

poisondeathray
26th November 2018, 07:27
Is it really supposed to be 128 FPS ? That might cause problems with some players. Does your display even support >60Hz ?

Quicktime 7 is limited, and you need special settings to make it compatible --ref 4 --qpmin 4 . (It's actually discontinued on Windows.)

stormy1777
26th November 2018, 07:47
Yes, 128FPS is correct, to remind, we are supposed to be going through a "direct copy stream" :) theoretically, nothing should be changing :) The original mp4 file plays just fine, and obviously opens OK in VD2 as it is the source file.. I've not set any other "encoding" flags, this is the mediainfo of the original file:

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.2
Format settings : CABAC / 8 Ref Frames
Format settings, CABAC : Yes
Format settings, RefFrames : 8 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 3 min 53 s
Bit rate : 8 689 kb/s
Maximum bit rate : 9 423 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 128.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.074
Stream size : 242 MiB (98%)
Title : mp4.Video.x264@GPAC0.7.0-rev0-gbd5c9af-master
Writing library : x264 core 157 r2935 545de2f
Encoding settings : cabac=1 / ref=8 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.15
/ mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=6 /
lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 /
b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 /
rc_lookahead=60 / rc=crf / mbtree=1 / crf=16.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 2018-11-18 22:43:07
Tagged date : UTC 2018-11-18 22:43:21
Codec configuration box : avcC

The only differences between the two are the lack of existence of these 4 lines (whereas they appear only in the original file):

Maximum bit rate : 9 423 kb/s
Title : mp4.Video.x264@GPAC0.7.0-rev0-gbd5c9af-master
Encoded date : UTC 2018-11-18 22:43:07
Tagged date : UTC 2018-11-18 22:43:21


Aside, the two file/info are identical... The assumption is that direct-copy-stream is "sort of like" an "OS copy", at least in the sense that the video will keep playing on same players it did before...

Stormy.