Different behavior of H.264 encoder MFT on Win7 and Win8 - ms-media-foundation

Several months have passed since I finished my program which uses H.264 and AAC encoder MFT to convert video files into MP4. While it works well on Win7, when I ran it on Win8 (also tried on Win10 Build 10240) yesterday, I found something different form what I saw on Win7.
My program calls MFT->ProcessInput() to send frames into encoder and calls ProcessOutput after every ProcessInput.
Below is the log generated when I convert a file on Win7. Every time ProcessInput is called, ProcessOutput returns a frame.
Line 178: 00:00:24.562 MAIN encoding time = 0, duration = 420000
Line 180: 00:00:24.828 MAIN sample returned, sample time = 0
Line 185: 00:00:24.875 MAIN encoding time = 420000, duration = 420000
Line 187: 00:00:25.234 MAIN sample returned, sample time = 420000
Line 192: 00:00:25.359 MAIN encoding time = 840000, duration = 420000
Line 194: 00:00:25.469 MAIN sample returned, sample time = 840000
Line 199: 00:00:25.484 MAIN encoding time = 1260000, duration = 410000
Line 201: 00:00:25.562 MAIN sample returned, sample time = 1260000
Line 206: 00:00:25.578 MAIN encoding time = 1670000, duration = 420000
Line 208: 00:00:25.656 MAIN sample returned, sample time = 1670000
Line 213: 00:00:25.672 MAIN encoding time = 2090000, duration = 420000
Line 215: 00:00:25.781 MAIN sample returned, sample time = 2090000
Line 220: 00:00:25.859 MAIN encoding time = 2510000, duration = 420000
Line 222: 00:00:26.015 MAIN sample returned, sample time = 2510000
Below is what I saw when converting same file on Windows 8.1 64bits and Windows 10
Line 196: 00:00:21.187 MAIN encoding time = 0, duration = 420000
Line 200: 00:00:21.203 MAIN encoding time = 420000, duration = 420000
Line 204: 00:00:21.234 MAIN encoding time = 840000, duration = 420000
Line 208: 00:00:21.265 MAIN encoding time = 1260000, duration = 410000
Line 210: 00:00:21.281 MAIN sample returned, sample time = 420000
Line 215: 00:00:21.297 MAIN encoding time = 1670000, duration = 420000
Line 217: 00:00:21.312 MAIN sample returned, sample time = 1260000
Line 222: 00:00:21.343 MAIN encoding time = 2090000, duration = 420000
Line 224: 00:00:21.359 MAIN sample returned, sample time = 840000
Line 230: 00:00:21.375 MAIN encoding time = 2510000, duration = 420000
Line 232: 00:00:21.406 MAIN sample returned, sample time = 2090000
Line 237: 00:00:21.422 MAIN encoding time = 2930000, duration = 410000
Line 239: 00:00:21.437 MAIN sample returned, sample time = 1670000
Line 245: 00:00:21.468 MAIN encoding time = 3340000, duration = 420000
Line 247: 00:00:21.484 MAIN sample returned, sample time = 2930000
Line 252: 00:00:21.515 MAIN encoding time = 3760000, duration = 420000
Line 254: 00:00:21.515 MAIN sample returned, sample time = 2510000
It doesn't matter first frame returns until 4 frames are sent to encoder, what matters to me is that the timestamps of returned frames are not monotonically increasing. (42, 126, 84, 209 ... timestamps is get by calling IMFSample->GetSampleTime()).
After that I ran mftrace on Windows 10 and get this
MFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessInput #0845899C Stream ID 0, Sample #08379F88, Time 0ms, Duration 42ms, Buffers 1, Size 345600B,
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessInput #0845899C Stream ID 0, Sample #0C16F1B8, Time 42ms, Duration 42ms, Buffers 1, Size 345600B,
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessInput #0845899C Stream ID 0, Sample #0C16F1B8, Time 84ms, Duration 42ms, Buffers 1, Size 345600B,
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessInput #0845899C Stream ID 0, Sample #0C16F1B8, Time 126ms, Duration 41ms, Buffers 1, Size 345600B,
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessInput #0845899C Stream ID 0, Sample #0C16F1B8, Time 167ms, Duration 42ms, Buffers 1, Size 345600B,
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessInput #0845899C Stream ID 0, Sample #0C16F1B8, Time 209ms, Duration 42ms, Buffers 1, Size 345600B,
CMFTransformDetours::ProcessOutput #0845899C Stream ID 0, Sample #08379F88, Time 42ms, Duration 42ms, Buffers 1, Size 24841B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=0 (0,0);{9154733F-E1BD-41BF-81D3-FCD918F71332}=65535;{973704E6-CD14-483C-8F20-C9FC0928BAD5}=0;MFSampleExtension_CleanPoint=1;{B2EFE478-F979-4C66-B95E-EE2B82C82F36}=29 (0,29)
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessInput #0845899C Stream ID 0, Sample #0C16F1B8, Time 251ms, Duration 42ms, Buffers 1, Size 345600B,
CMFTransformDetours::ProcessOutput #0845899C Stream ID 0, Sample #08379F88, Time 126ms, Duration 42ms, Buffers 1, Size 1152B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=420000 (0,420000);{9154733F-E1BD-41BF-81D3-FCD918F71332}=65535;{973704E6-CD14-483C-8F20-C9FC0928BAD5}=1;MFSampleExtension_CleanPoint=0;{B2EFE478-F979-4C66-B95E-EE2B82C82F36}=29 (0,29)
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessInput #0845899C Stream ID 0, Sample #0C16F1B8, Time 293ms, Duration 41ms, Buffers 1, Size 345600B,
CMFTransformDetours::ProcessOutput #0845899C Stream ID 0, Sample #08379F88, Time 84ms, Duration 42ms, Buffers 1, Size 20B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=840000 (0,840000);{9154733F-E1BD-41BF-81D3-FCD918F71332}=65535;{973704E6-CD14-483C-8F20-C9FC0928BAD5}=2;MFSampleExtension_CleanPoint=0;{B2EFE478-F979-4C66-B95E-EE2B82C82F36}=29 (0,29)
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
Lets check ProcessOutput only
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessOutput #0845899C Stream ID 0, Sample #08379F88, Time 42ms, Duration 42ms, Buffers 1, Size 24841B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=0 (0,0);{9154733F-E1BD-41BF-81D3-FCD918F71332}=65535;{973704E6-CD14-483C-8F20-C9FC0928BAD5}=0;MFSampleExtension_CleanPoint=1;{B2EFE478-F979-4C66-B95E-EE2B82C82F36}=29 (0,29)
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessOutput #0845899C Stream ID 0, Sample #08379F88, Time 126ms, Duration 42ms, Buffers 1, Size 1152B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=420000 (0,420000);{9154733F-E1BD-41BF-81D3-FCD918F71332}=65535;{973704E6-CD14-483C-8F20-C9FC0928BAD5}=1;MFSampleExtension_CleanPoint=0;{B2EFE478-F979-4C66-B95E-EE2B82C82F36}=29 (0,29)
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
CMFTransformDetours::ProcessOutput #0845899C Stream ID 0, Sample #08379F88, Time 84ms, Duration 42ms, Buffers 1, Size 20B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=840000 (0,840000);{9154733F-E1BD-41BF-81D3-FCD918F71332}=65535;{973704E6-CD14-483C-8F20-C9FC0928BAD5}=2;MFSampleExtension_CleanPoint=0;{B2EFE478-F979-4C66-B95E-EE2B82C82F36}=29 (0,29)
CMFTransformDetours::ProcessOutput #0845899C failed hr=0xC00D6D72 MF_E_TRANSFORM_NEED_MORE_INPUT
we can see that the returned timestamps are 42, 126, 84 ...
Because in my program, the muxer (which muxes encoded video and audio data and write them into files) requires monotonically increasing timestamps, the behavior of H.264 encoder MFT on Win8/10 breaks the file conversion.
If anyone is interested in whole mftrace log, I've put it here https://dl.dropboxusercontent.com/u/89678527/mfrelease.log
Thanks for any suggestion.

Related

CrossReferencing error; how can fix it in metboAnalystR?

I try to enrich my metabolite with MetboAnalystR and then when i want to Cross-reference list of compounds against libraries,
I faced with the error. This is my code:
tmp.vec <- c("L-Alanine", "Hexadecanoic acid", "L-Phenylalanine", "O-Propanoylcarnitine", "L-Methionine",
"L-Palmitoylcarnitine", "Triacylglycerol")
mSet<-InitDataObjects("conc", "msetora", FALSE)
mSet<-Setup.MapData(mSet, tmp.vec)
mSet<-CrossReferencing(mSet, "name")
In the last code, I get this error:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:21 --:--:-- 0
curl: (28) Failed to connect to www.metaboanalyst.ca port 443 after 21166 ms: Timed out
[1] "Download unsucceful. Ensure that curl is downloaded on your computer."
[1] "Attempting to re-try download using libcurl..."
trying URL 'https://www.metaboanalyst.ca/resources/libs/compound_db.qs'
Error in download.file(lib.url, destfile = filenm, method = "libcurl") :
cannot open URL 'https://www.metaboanalyst.ca/resources/libs/compound_db.qs'
In addition: Warning message:
In download.file(lib.url, destfile = filenm, method = "libcurl") :
URL 'https://www.metaboanalyst.ca/resources/libs/compound_db.qs': Timeout of 60 seconds was reached
what should I do for solving?
thank you for helping

Neo.DatabaseError.General.UnknownError GC overhead limit exceeded in R 10.12.1

Totally new to neo4j, I was running the csv file when this issue occurred, how can I fix this? thanks so much!!
library("RNeo4j")
library("curl")
graph <- startGraph("http://localhost:7474/db/data", username = "neo4j", password = "")
clear(graph, input = F)
query <- "LOAD CSV WITH HEADERS FROM {csv} AS row CREATE (n:flights {year: row.year, month: row.mo, dep_time: row.dep_time, arr_time: row.arr_time, carrier: row.carrier, tailnum: row.tailnum, flight: row.flight, origin: row.origin, dest: row.dest, air_time: row.air_time, distance: row.distance, hour: row.hour, minute: row.minute })
cypher(graph, query, csv = "file:///flights1/flights.csv")
Error: Client error: (400) Bad Request
Neo.DatabaseError.General.UnknownError
GC overhead limit exceeded

Count the amount of observations in predetermined timestep

I have a large dataset of over 75.000 observations. Of these observations I have a list of date and time combinations. I want to calculate the observation frequency in a predetermined timestep (15, 30 or 60 minutes). The study period is from 2014-10-21 00:00 to 2015-10-21 23:59.
The raw data is stored in a DF, but date (as POSIXlt) and time (as character) are in different columns, so I combine them back into one column to create a POSIXct timestamp.
receiver$date2 = as.POSIXct(paste(receiver$date, receiver$time), format="%Y-
%m-%d %H:%M:%S")
dateseq = receiver$date2
dateseq is now (only a small fragment using dput()):
dateseq = structure(c(1414140420, 1414140720, 1414140960, 1414141080, 1414143540, 1414144980, 1414145940, 1414147380, 1414147440, 1414148100, 1414148280, 1414152720, 1414153740, 1414154520, 1414154580, 1414158540, 1414159380, 1414159680, 1414164240, 1414164300, 1414164840, 1414164900, 1414165500, 1414166100, 1414166220, 1414166460, 1414166520, 1414166820, 1414166880, 1414166940, 1414167300, 1414167360, 1414167480, 1414167780, 1414168380, 1414168440, 1414168800, 1414168860, 1414202040, 1414202220, 1414202280, 1414202700, 1414202820, 1414202880, 1414203660, 1414203960, 1414215180, 1414215300, 1414215900, 1414216560, 1414216860, 1414217220, 1414217280, 1414217460, 1414217580, 1414217700, 1414217820, 1414217880, 1414218240, 1414218720, 1414219380, 1414219800, 1414219920, 1414219980, 1414220160, 1414220280, 1414220820, 1414220880, 1414221000, 1414221960, 1414222080, 1414222200, 1414222320, 1414222500, 1414222560, 1414222860, 1414223640, 1414224780, 1414225800, 1414225920, 1414225980, 1414226040, 1414226100, 1414226220, 1414227240, 1414227420, 1414227600, 1414230300, 1414230540, 1414230840, 1414231140, 1414231320, 1414231440, 1414231560, 1414231800, 1414231860, 1414232040, 1414232160, 1414232400, 1414232520, 1414232640, 1414232700, 1414232760, 1414232880, 1414232940, 1414233060, 1414233180, 1414233240, 1414233300, 1414233420, 1414233480, 1414233660, 1414233720, 1414233780, 1414233840, 1414233960, 1414234080, 1414234320, 1414234440, 1414234560, 1414234620, 1414234740, 1414234860, 1414234980, 1414235040, 1414235280, 1414236240, 1414236300, 1414236420, 1414236540, 1414236840, 1414236900, 1414236960, 1414237020, 1414237260, 1414237560, 1414237860, 1414238280, 1414238400, 1414238460, 1414238580, 1414238640, 1414239180, 1414239300, 1414239360, 1414239480, 1414239540, 1414240440, 1414240860, 1414240920, 1414240980, 1414241040, 1414242000, 1414242180, 1414242480, 1414242540, 1414242660, 1414242720, 1414242840, 1414242900, 1414243800, 1414243920, 1414244280, 1414244460, 1414245240, 1414245600, 1414245660, 1414246080, 1414246500, 1414246680, 1414246740, 1414246920, 1414247340, 1414248180, 1414249320, 1414249560, 1414249860, 1414250340, 1414250520, 1414250640, 1414250760, 1414250880, 1414250940, 1414251060, 1414251240, 1414251900, 1414252020, 1414252080, 1414252200, 1414252260, 1414252380, 1414252440, 1414252440, 1414252500, 1414252560, 1414252680, 1414252980, 1414253160, 1414253460, 1414253580), class = c("POSIXct", "POSIXt"), tzone = "")
Then I want to have a timeseq that runs for the whole period (so also the days that don't have any observations) divided by the predetermined timestep.
timestep = 1800 # 1800 sec = 30 min
start = "2014-10-21 00:00"
end = "2015-10-21 23:59"
receiver = R125926
timeseq = seq(from = as.POSIXct(start), to = as.POSIXct(end), by = timestep)
Now I want to 'fill' a new dataframe with the timeseq in one column and the count data of how many observations (from dateseq) occurred in that time period.
EDIT
After some searching on the forum and adjusting some code, I came to one very simple method that brings me very close to what I want my results to look like:
det_interval = data.frame(table(cut(dateseq, breaks = "30 min")))
There's only two adjustments that I don't know how to do. Now it begins at the first record (e.g. when my first record is on 05.17 the interval it will use will be x.17 - x.47 (30min)), not at the start that I want (see the timeseq created above). So how can I make sure that this starts and ends at a predetermined date/time?

Querying trades from IB using reqExecutions

Im trying to query trades from IB by using function reqExecutions:
library(IBrokers)
con <- twsConnect(clientId=1)
id <- reqIds(con)
Order <- twsOrder(orderId=id, action="BUY", totalQuantity = 1, orderType="LMT", lmtPrice = 600, tif="GTC")
placeOrder(con, twsSTK("AAPL", Order)
print(reqExecutions(con, reqId = as.character(.Last.orderId), ExecutionFilter = twsExecutionFilter(clientId="1")))
although trades are executed in IB, it always returns NULL.
Can't you just use reqOpenOrders?
Warning: The following will execute a trade. Make sure you are connected to a paper trading account before running this code!
library(IBrokers)
#con <- twsConnect(clientId=1)
con <- ibgConnect(clientId=1)
id <- reqIds(con)
Order <- twsOrder(orderId=id, action="BUY", totalQuantity = 1, orderType="LMT",
lmtPrice = 600, tif="GTC")
placeOrder(con, twsSTK("AAPL"), Order)
> reqOpenOrders(twsconn=con)
TWS Message: 2 -1 2100 New account data requested. API client has been unsubscribed from account data.
TWS Execution: orderId=1 time=2012-03-26 08:47:29 side=BOT shares=1 symbol=AAPL conId=265598 price=597.91

ASP.Net and listening to event through open connection - is it possible to raise number of concurrently executing threads?

I am trying to use IIS to host an event-driven web-application. Lets say I want to use it for a chat-type application.
Instead of polling once every second or so (delay) I want to leave an open connection to my application which returns once there is data available.
The problem is that I can't get more than 10 concurrent threads executing.
I've set MaxThreads to 5000/5000, MaxConcurrentRequestsPerCpu to 5000, QueueLimit is 5000 by default, MaxConcurrentThreadsPerCPU is 0 (unbounded).
The only thing is that DefaultConnectionLimit seems to be 12 by default, and I can't seem to change it in my web.config. I've managed to set it in global.asax Application_Start but I don't know if it is too late to set it at that point. It says in the documentation that it does not affect already initialized ServicePoints.
<system.net>
<connectionManagement>
<add address="*" maxconnection="100" />
</connectionManagement>
</system.net>
The above is what I have in my web.config (that concerns DefaultConnectionLimit).
5/14/2011 3:34:45 PM with timediff 0 : Entered method with threadId: 6, MaxThreads is 5000/5000, MaxConcurrentRequestsPerCPU is 5000, MaxConcurrentThreadsPerCPU is 0, MinThreads is 1, AvailableThreads is 4998 and DefaultConnectionLimit is 1500
5/14/2011 3:34:45 PM with timediff 0 : Entered method with threadId: 5, MaxThreads is 5000/5000, MaxConcurrentRequestsPerCPU is 5000, MaxConcurrentThreadsPerCPU is 0, MinThreads is 1, AvailableThreads is 4998 and DefaultConnectionLimit is 1500
5/14/2011 3:34:46 PM with timediff 0.5 : Entered method with threadId: 7, MaxThreads is 5000/5000, MaxConcurrentRequestsPerCPU is 5000, MaxConcurrentThreadsPerCPU is 0, MinThreads is 1, AvailableThreads is 4997 and DefaultConnectionLimit is 1500
5/14/2011 3:34:47 PM with timediff 1.5 : Entered method with threadId: 8, MaxThreads is 5000/5000, MaxConcurrentRequestsPerCPU is 5000, MaxConcurrentThreadsPerCPU is 0, MinThreads is 1, AvailableThreads is 4996 and DefaultConnectionLimit is 1500
5/14/2011 3:34:48 PM with timediff 2.5 : Entered method with threadId: 9, MaxThreads is 5000/5000, MaxConcurrentRequestsPerCPU is 5000, MaxConcurrentThreadsPerCPU is 0, MinThreads is 1, AvailableThreads is 4995 and DefaultConnectionLimit is 1500
5/14/2011 3:34:49 PM with timediff 3.5 : Entered method with threadId: 10, MaxThreads is 5000/5000, MaxConcurrentRequestsPerCPU is 5000, MaxConcurrentThreadsPerCPU is 0, MinThreads is 1, AvailableThreads is 4994 and DefaultConnectionLimit is 1500
5/14/2011 3:34:50 PM with timediff 4.5 : Entered method with threadId: 12, MaxThreads is 5000/5000, MaxConcurrentRequestsPerCPU is 5000, MaxConcurrentThreadsPerCPU is 0, MinThreads is 1, AvailableThreads is 4993 and DefaultConnectionLimit is 1500
5/14/2011 3:34:51 PM with timediff 5.5 : Entered method with threadId: 13, MaxThreads is 5000/5000, MaxConcurrentRequestsPerCPU is 5000, MaxConcurrentThreadsPerCPU is 0, MinThreads is 1, AvailableThreads is 4992 and DefaultConnectionLimit is 1500
5/14/2011 3:34:52 PM with timediff 6.5 : Entered method with threadId: 14, MaxThreads is 5000/5000, MaxConcurrentRequestsPerCPU is 5000, MaxConcurrentThreadsPerCPU is 0, MinThreads is 1, AvailableThreads is 4991 and DefaultConnectionLimit is 1500
5/14/2011 3:34:52 PM with timediff 7 : Entered method with threadId: 15, MaxThreads is 5000/5000, MaxConcurrentRequestsPerCPU is 5000, MaxConcurrentThreadsPerCPU is 0, MinThreads is 1, AvailableThreads is 4990 and DefaultConnectionLimit is 1500
5/14/2011 3:36:45 PM with timediff 120 : Exiting method with threadId: 6
5/14/2011 3:36:45 PM with timediff 120 : Exiting method with threadId: 5
5/14/2011 3:36:46 PM with timediff 120.5 : Exiting method with threadId: 7
5/14/2011 3:36:47 PM with timediff 121.5 : Exiting method with threadId: 8
5/14/2011 3:36:48 PM with timediff 122.5 : Exiting method with threadId: 9
5/14/2011 3:36:49 PM with timediff 123.5 : Exiting method with threadId: 10
The above is an excerpt from the log file I am producing to test thread concurrency. It is simply an MVC action method with a 120 second sleep in it. Timediff is the difference from first request to the current request being logged.
As you can see, AvailableThreads dip down to 4990, and then waits for the other threads to exit before continuing. The delay between requests seems to be Fiddlers fault (which I use to load test).
I've also tried BadBoy to issue the same requests, and it also suffers from the 10 thread limit.
Is this because the connections are from the same client? Is there some other limit I have missed? It's admittedly difficult to load-test with different hosts..
If you test your application under Windows 7. It has 10 concurrent connections limit. Additionally, you may find (IISTuner) useful.

Resources