Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

 
Not Able To Pipe Video Or Audio To Ffmpeg
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
bryanburke
Posted: Jul 3 2013, 09:13 PM


Newbie


Group: Members
Posts: 5
Member No.: 36750
Joined: 3-July 13



VirtualDub version: 1.10.3 64-bit
FFMPEG version: 1.2-win64-static (from Zeranoe)
VirtualDub external encoder settings: http://pastebin.com/2kfWeuAw
OS: Windows 7 64-bit

When I try to pipe raw YV12 video and raw PCM audio to FFMPEG using the above setup, I get one of the following errors:

CODE

[E] Error: The video encoding process has prematurely exited with an error
   code of 1 (00000001). Check the log for possible error messages.

or
CODE

[E] Error: Write error occurred on file "<anonymous pipe>": the pipe has been ended.


When I switch my external video encoder to x264, the video gets piped through, but the audio still fails with FFMPEG. Am I doing something wrong?
 
    Top
raffriff42
Posted: Jul 3 2013, 09:48 PM


Advanced Member


Group: Members
Posts: 384
Member No.: 35081
Joined: 25-June 12



1. "redirect standard error to log" should always be checked, so your error messages can be seen in the log.

2. quote all file macros everywhere: %(tempvideofile) should be "%(tempvideofile)"

3. -pix_fmt + may be a problem, depending on source. Not sure. I use -pix_fmt yuv420p
(-pix_fmt + disables auto format conversion)

See this post and the following ones on the External encoders thread.
 
     Top
bryanburke
Posted: Jul 3 2013, 10:37 PM


Newbie


Group: Members
Posts: 5
Member No.: 36750
Joined: 3-July 13



Thanks for the quick reply. I made the changes you suggested, and this time with stderr redirected to the log I get the following:

CODE

[i] VideoEnc:   libpostproc    52.  2.100 / 52.  2.100

[i] VideoEnc: [rawvideo @ 0000000002127fe0] Estimating duration from bitrate,
   this may be inaccurate

[i] VideoEnc: Input #0, rawvideo, from 'pipe:':

[i] VideoEnc:   Duration: N/A, start: 0.000000, bitrate: 746496 kb/s

[i] VideoEnc:     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p,
   1920x1080, 746496 kb/s, 30 tbr, 30 tbn, 30 tbc

[i] VideoEnc: [libx264 @ 000000000251ad00] bad option 'profile': 'high'

[i] VideoEnc: Output #0, mp4, to 'H:\output.mp4.mp4':

[i] VideoEnc:     Stream #0:0: Video: h264, yuv420p, 1920x1080, q=-1--1, 90k
   tbn, 30 tbc

[i] VideoEnc: Stream mapping:

[i] VideoEnc:   Stream #0:0 -> #0:0 (rawvideo -> libx264)

[i] VideoEnc: Error while opening encoder for output stream #0:0 - maybe
   incorrect parameters such as bit_rate, rate, width or height

[i] AudioEnc:   libswresample   0. 17.102 /  0. 17.102

[i] AudioEnc:   libpostproc    52.  2.100 / 52.  2.100

[i] AudioEnc: pipe:: Invalid data found when processing input

[E] Error: The video encoding process has prematurely exited with an error
   code of 1 (00000001). Check the log for possible error messages.


Here is my updated external encoder profile: http://pastebin.com/HvK3H1UT
 
    Top
raffriff42
Posted: Jul 3 2013, 10:43 PM


Advanced Member


Group: Members
Posts: 384
Member No.: 35081
Joined: 25-June 12



See my edited post above, hopefully it's more clearly written.

Here's your problem: "bad option 'profile': 'high'"
Seems like -x264opts profile=high is not supported in ffmpeg?? Dunno...

http://superuser.com/questions/563997/how-...vel-with-ffmpeg
Try -profile high instead

To everybody: when creating external encoders, start with the simplest possible command line; once you get it working, start adding your optional settings.
 
     Top
bryanburke
Posted: Jul 3 2013, 10:56 PM


Newbie


Group: Members
Posts: 5
Member No.: 36750
Joined: 3-July 13



I removed "profile=high" from the -x264opts parameter and added "-profile:v high" as an FFMPEG parameter per the FFMPEG wiki. Now the video is piping through (with "-pix_fmt +" working) but the audio pipe is giving me the very nondescript error:

CODE

[i] AudioEnc: pipe:: Invalid data found when processing input


When I disable audio and just try to encode and mux video, the muxer spits out:

CODE

[i] Mux: : No such file or directory
 
    Top
bryanburke
Posted: Jul 3 2013, 11:01 PM


Newbie


Group: Members
Posts: 5
Member No.: 36750
Joined: 3-July 13



Sorry for the double post. It just occurred to me that Zeranoe's build of FFMPEG might not have libfdk_aac since its inclusion has to be specified explicitly at compile time. A quick check of the compile options confirms that suspicion. If I can't find a version of FFMPEG compiled with libfdk_aac, I'll try the faac codec and report my results.
 
    Top
raffriff42
Posted: Jul 3 2013, 11:14 PM


Advanced Member


Group: Members
Posts: 384
Member No.: 35081
Joined: 25-June 12



Sounds reasonable. I have been encoding to AC3 with ffmpeg, leaving AAC to NeroAAC.
 
     Top
bryanburke
Posted: Jul 4 2013, 12:10 AM


Newbie


Group: Members
Posts: 5
Member No.: 36750
Joined: 3-July 13



Got it! It turns out libfaac is also not distributed with Zeranoe's FFMPEG builds because the option --enable-nonfree is required at compile time. It also turns out that the fdk-aac library (which comes from Android) is commercially copyrighted freeware with no licensing restrictions other than that it is not compatible with the GPL (which only affects distribution with GPL code). This means that anyone can compile fdk-aac and encode their audio with it, even if that encoded audio will be used for profit. Luckily, someone on github named nu774 has created a CLI encoder using the fdk-aac library from Android: https://github.com/nu774/fdkaac. He/she even created autobuild scripts that can produce a Windows executable: https://github.com/nu774/fdkaac_autobuild. So, after compiling fdkaac on my machine, I set up my external encoder profile as follows:

CODE

{
"description": "VirtualDub external encoder profile collection",
"externalEncoders": {
 "sets": {
  "YouTube": {
   "videoEncoder": "YouTube Video",
   "audioEncoder": "YouTube Audio",
   "multiplexer": "YouTube Muxer",
   "description": ".MP4 (H.264/AAC)",
   "extension": "mp4",
   "processPartial": false,
   "useOutputAsTemp": false
  }
 },
 "profiles": {
  "YouTube Video": {
   "name": "YouTube Video",
   "program": "tools\\ffmpeg\\bin\\ffmpeg.exe",
   "commandArguments": "-f rawvideo -s %(width)x%(height) -r %(fps) -i - -c:v libx264 -pix_fmt + -profile:v high -level:v 4.1 -preset veryslow -crf 22 -x264opts no-interlaced:colormatrix=bt709:vbv-bufsize=78125:vbv-maxrate=62500:b-adapt=2:bframes=2:keyint=15:trellis=2 \"%(tempvideofile)\"",
   "outputFilename": "%(outputname).mp4",
   "type": 0,
   "inputFormat": 0,
   "checkReturnCode": true,
   "logStdout": true,
   "logStderr": true,
   "bypassCompression": false,
   "predeleteOutputFile": false
  },
  "YouTube Audio": {
   "name": "YouTube Audio",
   "program": "tools\\fdkaac.exe",
   "commandArguments": "-b 393216 -w %(samplingrate) -o \"%(tempaudiofile)\" -R --raw-channels %(channels) --raw-rate %(samplingrate) --raw-format S%(audioprecision)L -",
   "outputFilename": "%(outputname).m4a",
   "type": 1,
   "inputFormat": 0,
   "checkReturnCode": true,
   "logStdout": true,
   "logStderr": true,
   "bypassCompression": false,
   "predeleteOutputFile": false
  },
  "YouTube Muxer": {
   "name": "YouTube Muxer",
   "program": "tools\\ffmpeg\\bin\\ffmpeg.exe",
   "commandArguments": "-i \"%(tempvideofile)\" -i \"%(tempaudiofile)\" -c:v copy -c:a copy -f mp4 \"%(outputname)\"",
   "outputFilename": "%(outputname).mp4",
   "type": 2,
   "inputFormat": 0,
   "checkReturnCode": true,
   "logStdout": true,
   "logStderr": true,
   "bypassCompression": false,
   "predeleteOutputFile": true
  }
 }
}
}


raffriff42,

Thanks to your help I am able to convert my gameplay videos recorded in DxTory using the Ut Video lossless codec and raw 16-bit 48000Hz PCM audio straight to a highly optimized format for YouTube upload without the need for an intermediate conversion. I am deeply appreciative of your aid, and I am thinking about taking all of this info along with info that I found elsewhere and compiling a guide in the General section of the forum. Thanks again!

Sincerely,
Bryan Burke
 
    Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
7 replies since Jul 3 2013, 09:13 PM Track this topic | Email this topic | Print this topic

<< Back to Codec Discussion