Hi I am using FedEx API's to get the rates of a shipment from Singapore to India, I am passing the parameters as required by the API but it throws error and I am not able to understand what is causing the problem from stack trace :
00:42:36.372 [http-bio-8106-exec-3] ERROR com.ocr.logistics.ci.api.impl.FedexSoapSenderImpl - Error Occured while FEDEX Fetch Rates
org.apache.axis.AxisFault: Fault
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222) ~[axis-1.4.jar:?]
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129) ~[axis-1.4.jar:?]
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087) ~[axis-1.4.jar:?]
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) ~[xercesImpl.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)]
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source) ~[xercesImpl.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) ~[xercesImpl.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) ~[xercesImpl.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[xercesImpl.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)]
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) ~[xercesImpl.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)]
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) ~[xercesImpl.jar:4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)]
at javax.xml.parsers.SAXParser.parse(Unknown Source) ~[?:1.8.0_111]
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227) ~[axis-1.4.jar:?]
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696) ~[axis-1.4.jar:?]
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435) ~[axis-1.4.jar:?]
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62) ~[axis-1.4.jar:?]
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206) ~[axis-1.4.jar:?]
at org.apache.axis.client.Call.invokeEngine(Call.java:2784) ~[axis-1.4.jar:?]
at org.apache.axis.client.Call.invoke(Call.java:2767) ~[axis-1.4.jar:?]
at org.apache.axis.client.Call.invoke(Call.java:2443) ~[axis-1.4.jar:?]
at org.apache.axis.client.Call.invoke(Call.java:2366) ~[axis-1.4.jar:?]
at org.apache.axis.client.Call.invoke(Call.java:1812) ~[axis-1.4.jar:?]
at com.fedex.rate.stub.RateServiceSoapBindingStub.getRates(RateServiceSoapBindingStub.java:2292) ~[fedex-client-library-rate.jar:?]
at com.ocr.logistics.ci.api.impl.FedexSoapSenderImpl.fetchRates(FedexSoapSenderImpl.java:62) [logistics-processor-1.0.jar:?]
at com.ocr.logistics.processor.impl.LogisticsProcessorImpl.fetchRates(LogisticsProcessorImpl.java:59) [logistics-processor-1.0.jar:?]
at com.ocr.logistics.processor.impl.LogisticsProcessorImpl.fetchCombinedRates(LogisticsProcessorImpl.java:75) [logistics-processor-1.0.jar:?]
at com.ocr.ead.global.action.LogisticsAction.getRates(LogisticsAction.java:676) [LogisticsAction.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:894) [ognl-3.1.12.jar:?]
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1539) [ognl-3.1.12.jar:?]
at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68) [ognl-3.1.12.jar:?]
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:96) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:88) [struts2-core-2.5.10.jar:2.5.10]
at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1615) [ognl-3.1.12.jar:?]
at ognl.ASTMethod.getValueBody(ASTMethod.java:91) [ognl-3.1.12.jar:?]
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212) [ognl-3.1.12.jar:?]
at ognl.SimpleNode.getValue(SimpleNode.java:258) [ognl-3.1.12.jar:?]
at ognl.Ognl.getValue(Ognl.java:467) [ognl-3.1.12.jar:?]
at ognl.Ognl.getValue(Ognl.java:431) [ognl-3.1.12.jar:?]
at com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:351) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:403) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:349) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:436) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) [struts2-core-2.5.10.jar:2.5.10]
at com.ocr.common.struts2.ActionAwareInterceptor.intercept(ActionAwareInterceptor.java:55) [global.jar:?]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.doIntercept(ConversionErrorInterceptor.java:139) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:133) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:133) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:69) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:88) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:248) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:99) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at com.ocr.common.struts2.PopulateEntityInterceptor.intercept(PopulateEntityInterceptor.java:108) [global.jar:?]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:174) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:171) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:193) [struts2-core-2.5.10.jar:2.5.10]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:247) [struts2-core-2.5.10.jar:2.5.10]
at org.apache.struts2.factory.StrutsActionProxy.execute(StrutsActionProxy.java:54) [struts2-core-2.5.10.jar:2.5.10]
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564) [struts2-core-2.5.10.jar:2.5.10]
at org.apache.struts2.dispatcher.ExecuteOperations.executeAction(ExecuteOperations.java:81) [struts2-core-2.5.10.jar:2.5.10]
at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:143) [struts2-core-2.5.10.jar:2.5.10]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.54]
at com.xss.filter.CrossScriptingFilter.doFilter(CrossScriptingFilter.java:117) [xssFilter.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.54]
at com.ocr.encode.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:122) [charEncodeFilter.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.54]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) [catalina.jar:7.0.54]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.54]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [catalina.jar:7.0.54]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) [catalina.jar:7.0.54]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [catalina.jar:7.0.54]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.54]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) [catalina.jar:7.0.54]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) [tomcat-coyote.jar:7.0.54]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) [tomcat-coyote.jar:7.0.54]
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) [tomcat-coyote.jar:7.0.54]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_111]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.54]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_111]
This is the error message in debug mode :
I was getting this error because of the wrong input... i was sending the null for address line in fedex request object, after replace null to empty string it worked fine.
Lookout for null in address line especially addressLine2 or phone number.
Related
I've uploaded my fully compiled code with its Makefile here:
https://pastebin.com/xtCTj06F
If I set 1280x720 I get the segmentation fault:
[libx264 # 0x7fdf4d25a600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 # 0x7fdf4d25a600] profile High, level 3.1
[libx264 # 0x7fdf4d25a600] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 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=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=12 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=12 rc=abr mbtree=1 bitrate=3400 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '1.mp4':
Stream #0:0: Video: h264, yuv420p, 1280x720, q=2-31, 3400 kb/s, 20 tbn
Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 64 kb/s
sws_scale BEGIN
./MakeVideo.sh: line 2: 26422 Segmentation fault: 11 ./MakeVideo 1.mp4
There's some problem with this line:
std::cout << "sws_scale BEGIN\n";
sws_scale( sws_context, ( const uint8_t * const * ) &rgb, inLinesize, 0, frame->height, frame->data, frame->linesize );
std::cout << "sws_scale END\n";
but if I set the size of a video to 1920x1080 or to 320x240 - all works fine.
Is that some sort of a magick?? Or a bug?
OS X 10.12.3
ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
Your code has numerous issues. For instance
void ffmpeg_encoder_set_frame_yuv_from_rgb( AVFrame *frame ) {
// frame pointer may be NULL, but is later used without check
uint8_t *rgb = (uint8_t *) malloc( 3 * sizeof( uint8_t ) * frame->width * frame->height );
// malloc may return NULL, but rgb is later used without check
// also rgb is never freed so memory leaks
sws_context = sws_getCachedContext(...
// sws_getCachedContext may return NULL, but sws_context is later used without check
I am trying to write a video using the FFmpeg libraries. So far I can successfully encode videos with the .avi extension, but when I use the .mp4 extension the application ignores completely the bitrate option I specify.
Here's a snippet of the code I use to specify the encoding settings:
//define video stream
AVOutputFormat* outFmt = nullptr;
outFmt = av_guess_format(NULL, m_pcFilename.c_str(), NULL);
avformat_alloc_output_context2(&m_pcOC, outFmt, NULL, NULL);
AVFormatContext* m_pcOC;
AVStream* m_pcVideoSt = avformat_new_stream(m_pcOC, NULL);
AVCodec* codec = nullptr;
codec = avcodec_find_encoder(codecID);
avcodec_get_context_defaults3(m_pcVideoSt->codec, codec);
//set some parameters
double dBitrate = std::stod(bitrate);
m_pcVideoSt->codec->codec_id = codecID;
m_pcVideoSt->codec->codec_type = AVMEDIA_TYPE_VIDEO;
m_pcVideoSt->codec->bit_rate = dBitrate;
m_pcVideoSt->codec->bit_rate_tolerance = 20000;
m_pcVideoSt->codec->width = m_iOutCols;
m_pcVideoSt->codec->height = m_iOutRows;
m_pcVideoSt->codec->time_base.den = static_cast<int>(dFps);
m_pcVideoSt->codec->time_base.num = 1;
if (m_pcOC->oformat->flags & AVFMT_GLOBALHEADER)
{
m_pcVideoSt->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
/* open the codec */
AVDictionary* pcOpts = nullptr;
int res1 = av_dict_set(&pcOpts, "b", bitrate.c_str(), 0);
int res = avcodec_open2(m_pcVideoSt->codec, codec, &pcOpts);
This is the output I get when creating a .avi file
ffprobe version 2.8.6 Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 5.3.0 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, avi, from 'testGrey2.avi':
Metadata:
encoder : Lavf56.40.101
Duration: 00:01:20.00, start: 0.000000, **bitrate: 433 kb/s**
Stream #0:0: Video: **mpeg4 (Advanced Simple Profile)** (FMP4 / 0x34504D46), yuv420p, 720x576 [SAR 1:1 DAR 5:4], 428 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
And this is what I get when creating an .mp4 file
ffprobe version 2.8.6 Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 5.3.0 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable- version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable- libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'testGrey2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:01:20.00, start: 0.000000, **bitrate: 1542 kb/s**
Stream #0:0(und): **Video: h264 (High)** (avc1 / 0x31637661), yuv420p, 720x576, 1540 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Any ideas on why is this happening? What is the preferred way to specify the bitrate of the output video?
Hi I'm attempting to use this to record output of my openframeworks app.
I was trying to use this extension here. As there seems like there is no built in method for this.
https://github.com/timscaffidi/ofxVideoRecorder
I have it producing a video file, but it looks like one of those scrolling sidewalk adverts, the frames scroll upwards instead of proceeding like a normal video. Any idea why?
I had this at the end of my setup method.
if(!vidRecorder.isInitialized())
{
vidRecorder.setup(fileName+ofGetTimestampString()+fileExt, ofGetWidth(), ofGetHeight(), 30); // no audio
}
Now I had the window mode set to fullscreen intitially and that gave me scanlines on the output, so I made it not full screen and I got the frames I already mentioned and then I set it to 640, 480 and I got more scanlines.
I was using this code in my update loop
ofImage img;
img.grabScreen(0, 0, ofGetWidth(), ofGetHeight());
vidRecorder.addFrame(img.getPixelsRef());
Here is the ffmpeg output.
[warning] ofThread: - name: Thread 4 - Calling startThread with verbose is deprecated.
[warning] ofThread: - name: Thread 2 - Calling startThread with verbose is deprecated.
ffmpeg version 2.6.1 Copyright (c) 2000-2015 the FFmpeg developers
built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, rawvideo, from '/Users/benjgorman/Code/OF_ROOT/addons/ofxTimeline/duplicate_lips/bin/data/ofxvrpipe0':
Duration: N/A, start: 0.000000, bitrate: 566231 kb/s
Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1024x768, 566231 kb/s, 30 tbr, 30 tbn, 30 tbc
Please use -b:a or -b:v, -b is ambiguous
Output #0, mov, to '/Users/benjgorman/Code/OF_ROOT/addons/ofxTimeline/duplicate_lips/bin/data/testMovie2015-04-16-11-21-31-504.mov':
Metadata:
encoder : Lavf56.25.101
Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 1024x768, q=2-31, 800 kb/s, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc56.26.100 mpeg4
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
frame= 9 fps=0.0 q=14.2 size= 861kB time=00:00:00.30 bitrate=23510.3kbits/s
frame= 19 fps= 18 q=24.8 size= 1330kB time=00:00:00.63 bitrate=17202.4kbits/s
frame= 31 fps= 20 q=24.8 size= 1864kB time=00:00:01.03
//
more frames here omitted for clarity
//
frame= 87 fps= 16 q=24.8 size= 4349kB time=00:00:02.90 bitrate=12286.0kbits/s
frame= 95 fps= 16 q=24.8 size= 4704kB time=00:00:03.16 bitrate=12169.1kbits/s
frame= 103 fps= 16 q=24.8 size= 5061kB time=00:00:03.43 bitrate=12075.1kbits/s
frame= 111 fps= 16 q=24.8 size= 5415kB time=00:00:03.70 bitrate=11990.0kbits/s
frame= 118 fps= 15 q=24.8 size= 5726kB time=00:00:03.93 bitrate=11925.3kbits/s
frame= 130 fps= 16 q=24.8 size= 6261kB time=00:00:04.33 bitrate=11835.3kbits/s
[rawvideo # 0x10201e000] Invalid buffer size, packet size 1179648 < expected frame_size 2359296
Error while decoding stream #0:0: Invalid argument
frame= 138 fps= 14 q=24.8 size= 6618kB time=00:00:04.60 bitrate=11785.4kbits/s
frame= 138 fps= 14 q=24.8 Lsize= 6620kB time=00:00:04.60 bitrate=11788.8kbits/s
video:6618kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.028923%
Is this an ffmpeg error? Or is there a better solution.
Could you suply the complete code? Are you using vidGrabber.update(); in the update?
Why don't you use:
ofApp.h
ofVideoGrabber vidGrabber;
ofxVideoRecorder vidRecorder;
bool bRecording;
void startRecord();
void stopRecord();
ofApp.c
void ofApp::setup(){
vidInput = ofPtr<ofQTKitGrabber>( new ofQTKitGrabber() );
vidGrabber.setGrabber(vidInput);
vidGrabber.initGrabber(1280, 720);
vidRecorder.setFfmpegLocation(ofFilePath::getAbsolutePath("ASSETS/ffmpeg"));
}
void ofApp::update(){
vidGrabber.update();
if(vidGrabber.isFrameNew()){
vidRecorder.addFrame(vidGrabber.getPixelsRef());
}
}
void ofApp::startRecord() {
bRecording = true;
if(bRecording && !vidRecorder.isInitialized()) {
vidRecorder.setup("your-file-name.mp4", vidGrabber.getWidth(), vidGrabber.getHeight(), 30, 44100, 2);
}
}
//--------------------------------------------------------------
void ofApp::stopRecord() {
bRecording = false;
vidRecorder.close();
}
I am new for gstreamer. I want to stream only audio/video on a rtp port. I tried following command to stream only video from mpeg file :
$ gst-launch-1.0 -v rtpbin name=rtpbin filesrc location=KRSNA.mpg ! decodebin ! 'video/mpeg' ! rtpmpvpay ! udpsink host=127.0.0.1 port=9078
Following is the verbose for command :
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = video/mpeg, systemstream=(boolean)true, mpegversion=(int)1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = video/mpeg, systemstream=(boolean)true, mpegversion=(int)1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegPSDemux:mpegpsdemux0.GstPad:sink: caps = video/mpeg, systemstream=(boolean)true, mpegversion=(int)1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0.GstPad:sink_0: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0.GstPad:sink_0: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegvParse:mpegvparse0.GstPad:sink: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0.GstPad:sink_1: caps = audio/mpeg, mpegversion=(int)1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0.GstPad:sink_1: caps = audio/mpeg, mpegversion=(int)1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0.GstPad:sink_1: caps = audio/mpeg, mpegversion=(int)1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegAudioParse:mpegaudioparse0.GstPad:src: caps = audio/mpeg, mpegversion=(int)1, mpegaudioversion=(int)1, layer=(int)2, rate=(int)48000, channels=(int)2, parsed=(boolean)true
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpg123AudioDec:mpg123audiodec0.GstPad:sink: caps = audio/mpeg, mpegversion=(int)1, mpegaudioversion=(int)1, layer=(int)2, rate=(int)48000, channels=(int)2, parsed=(boolean)true
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegvParse:mpegvparse0.GstPad:src: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, parsed=(boolean)true, width=(int)720, height=(int)576, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)16/15, codec_data=(buffer)000001b32d0240830c352398
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/avdec_mpeg2video:avdec_mpeg2video0.GstPad:sink: caps = video/mpeg, mpegversion=(int)1, systemstream=(boolean)false, parsed=(boolean)true, width=(int)720, height=(int)576, framerate=(fraction)25/1, pixel-aspect-ratio=(fraction)16/15, codec_data=(buffer)000001b32d0240830c352398
Redistribute latency...
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpg123AudioDec:mpg123audiodec0.GstPad:src: caps = audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/avdec_mpeg2video:avdec_mpeg2video0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)720, height=(int)576, pixel-aspect-ratio=(fraction)16/15, interlace-mode=(string)progressive, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-buffers = 5
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-time = 0
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-bytes = 2097152
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-buffers = 5
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-time = 0
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMultiQueue:multiqueue0: max-size-bytes = 2097152
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1: caps = video/mpeg
/GstPipeline:pipeline0/GstCapsFilter:capsfilter2: caps = video/mpeg
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpg123AudioDec:mpg123audiodec0.GstPad:src: caps = audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_1: caps = audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_1.GstProxyPad:proxypad8: caps = audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2, channel-mask=(bitmask)0x0000000000000003
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/avdec_mpeg2video:avdec_mpeg2video0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)720, height=(int)576, pixel-aspect-ratio=(fraction)16/15, interlace-mode=(string)progressive, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_0: caps = video/x-raw, format=(string)I420, width=(int)720, height=(int)576, pixel-aspect-ratio=(fraction)16/15, interlace-mode=(string)progressive, colorimetry=(string)bt601, framerate=(fraction)25/1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_0.GstProxyPad:proxypad9: caps = video/x-raw, format=(string)I420, width=(int)720, height=(int)576, pixel-aspect-ratio=(fraction)16/15, interlace-mode=(string)progressive, colorimetry=(string)bt601, framerate=(fraction)25/1
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegPSDemux:mpegpsdemux0: Internal data stream error.
Additional debug info:
gstmpegdemux.c(2871): gst_flups_demux_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstMpegPSDemux:mpegpsdemux0:
stream stopped, reason not-linked
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
How to stream only audio/video from mpeg file using gstreamer ?
Any help/pointers appriciated ...
Please try not using decodebin. Use the compatible demuxer element and then use the required parser and decoder elements.
If you want to run elementary (only video / only audio) out of a container format, use the required elements ( video elements for video stream / audio elements for audio stream).
gst-launch-0.10 filesrc location=sample.mkv ! matroskademux ! h264parse ! ffdec_h264 ! ffmpegcolorspace ! autovideosink
The above statement for example will give the video output ignoring audio and same can be achieved for audio.
Hope this helps, also look here
gst-launch-0.10 filesrc location=c:/test.mpg ! mpegpsdemux ! mpegvideoparse ! mpeg2dec ! rtpvrawpay ! udpsink port=9078
This pipeline works for me, although I had to substitute mpegpsdemux for tsdemux, since I only had the former installed.
Hi I have tried to modify the lkdemo.cpp in OpenCV/sample/cpp.
I want to get perspective transform and then warpPerspective.
So I have added line (1) and (2) to do that.
Where declaration for image and output are as follows:
Mat gray, prevGray, image, output;
....
calcOpticalFlowPyrLK(prevGray, gray, points[0], points[1], status, err, winSize,
3, termcrit, 0, 0.001);
(1) CvMat H = getPerspectiveTransform(points[0], points[1]);
(2) cvWarpPerspective(&image, &output, &H,CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS, cvScalarAll(0));
...
Now when I try to see the output of warp image using imshow() I'm getting this error:
error: (-206) Unrecognized or unsupported array type in function cvGetMat
Backtrace after debugging is as follows:
(gdb) bt
#0 0xb7fdd424 in __kernel_vsyscall ()
#1 0xb77741ef in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2 0xb7777835 in __GI_abort () at abort.c:91
#3 0xb79e313d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#4 0xb79e0ed3 in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#5 0xb79e0f0f in std::terminate() () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#6 0xb79e105e in __cxa_throw () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#7 0xb7eb9363 in cv::error(cv::Exception const&) () from /usr/local/lib/libopencv_core.so.2.4
#8 0xb7e40496 in cvGetMat () from /usr/local/lib/libopencv_core.so.2.4
#9 0xb7ceb915 in cvImageWidgetSetImage(_CvImageWidget*, void const*) () from /usr/local/lib/libopencv_highgui.so.2.4
#10 0xb7ced4e0 in cvShowImage () from /usr/local/lib/libopencv_highgui.so.2.4
#11 0xb7cea378 in cv::imshow(std::string const&, cv::_InputArray const&) () from /usr/local/lib/libopencv_highgui.so.2.4
#12 0x0804a1ca in main (argc=2, argv=0xbffff724) at lkdemo-1.cpp:141
(gdb)
Please anyone help me to fix this.
Actually I am getting above mentioned error due to mismatch in the number of points required for the getPerspectiveTransform method.
Error was: error: OpenCV Error: Assertion failed (src.checkVector(2, CV_32F) == 4 && dst.checkVector(2, CV_32F) == 4) in getPerspectiveTransform
Actually it requires four points for the transformation and I am using all points.
Here is the correct way of calling getPerspectiveTransform with lk optical flow, in case you need.
std::vector<Point2f> img1_corners(4);
img1_corners[0] = cvPoint(0,0);
img1_corners[1] = cvPoint( gray.cols, 0 );
img1_corners[2] = cvPoint( gray.cols, gray.rows );
img1_corners[3] = cvPoint( 0, gray.rows );
std::vector<Point2f> img2_corners(4);
vector<uchar> status;
vector<float> err;
calcOpticalFlowPyrLK(gray, gray1, img1_corners, img2_corners, status, err, winSize,
3, termcrit, 0, 0.001);
//calcOpticalFlowPyrLK(gray, gray1, corner1, corner2, status, err, winSize,
// 3, termcrit, 0, 0.001);
Mat H = getPerspectiveTransform(img1_corners, img2_corners);
//Mat H = getPerspectiveTransform(corner1, corner2);