private void changeToMp3(String sourcePath) { File source = new File(sourcePath); String mp3TargetPath = sourcePath.substring(0, sourcePath.lastIndexOf(".")) + ".mp3"; LOG.debug("MP3 - file path = " + mp3TargetPath); File target = new File(mp3TargetPath); AudioAttributes audio = new AudioAttributes(); Encoder encoder = new Encoder(); // pcm_s16le libmp3lame libvorbis libfaac audio.setCodec("libmp3lame"); EncodingAttributes attrs = new EncodingAttributes(); attrs.setFormat("mp3"); attrs.setAudioAttributes(audio); /* AudioAttributes audio = new AudioAttributes(); Encoder encoder = new Encoder(); audio.setBitRate(new Integer(128000)); audio.setChannels(new Integer(2)); audio.setSamplingRate(new Integer(44100)); audio.setCodec("libmp3lame"); EncodingAttributes attrs = new EncodingAttributes(); attrs.setFormat("mp3"); attrs.setAudioAttributes(audio); attrs.setDuration(3f); */ /*try { attrs.setDuration(getAmrDuration(source)); } catch (IOException e) { LOG.error(e.getMessage(), e); } */ try { encoder.encode(source, target, attrs); } catch (IllegalArgumentException e) { LOG.error(e.getMessage(), e); } catch (InputFormatException e) { LOG.error(e.getMessage(), e); } catch (EncoderException e) { LOG.error(e.getMessage(), e); } }
2015-06-10 01:16:12 DispatcherServlet 843 [DEBUG] DispatcherServlet with name 'mainServlet' processing POST request for [/pp/profile/saveVisualizationConfig.do] 2015-06-10 01:16:12 RequestMappingHandlerMapping 222 [DEBUG] Looking up handler method for path /profile/saveVisualizationConfig.do 2015-06-10 01:16:12 RequestMappingHandlerMapping 229 [DEBUG] Returning handler method [public java.lang.String com.wp.pp.web.controller.TemplateConfigController.saveVisualizationConfig(org.springframework.ui.Model,java.lang.String,java.lang.String,java.lang.String,java.lang.String)] 2015-06-10 01:16:12 DefaultListableBeanFactory 249 [DEBUG] Returning cached instance of singleton bean 'templateConfigController' 2015-06-10 01:16:12 TemplateConfigController 594 [DEBUG] userName = ??? 2015-06-10 01:16:12 TemplateConfigController 595 [DEBUG] userId = 808809b1-6a66-4839-b619-7aaea276b995 2015-06-10 01:16:12 TemplateConfigController 596 [DEBUG] phtotServerId = 2015-06-10 01:16:12 TemplateConfigController 597 [DEBUG] voiceServerId = PAtgTHiF5Yc9rWSTdViBlkRxSag8LoQ5uQZVsw6yRxPkTQjSjQvlNQRwkdvLzyw3 2015-06-10 01:16:12 SharedEntityManagerCreator$SharedEntityManagerInvocationHandler 248 [DEBUG] Creating new EntityManager for shared EntityManager invocation 2015-06-10 01:16:12 SessionImpl 316 [DEBUG] Opened session at timestamp: 14338701722 2015-06-10 01:16:12 CriteriaQueryCompiler 219 [DEBUG] Rendered criteria query -> select generatedAlias0 from User as generatedAlias0 where generatedAlias0.userId=:param0 2015-06-10 01:16:12 LogicalConnectionImpl 295 [DEBUG] Obtaining JDBC connection 2015-06-10 01:16:12 LogicalConnectionImpl 301 [DEBUG] Obtained JDBC connection 2015-06-10 01:16:12 SQL 104 [DEBUG] select user0_.userId as userId9_, user0_.email as email9_, user0_.fullPhotoUrl as fullPhot3_9_, user0_.goodByAudioServerId as goodByAu4_9_, user0_.goodByeAudioUrl as goodByeA5_9_, user0_.introduceAudioUrl as introduc6_9_, user0_.isSubScribe as isSubScr7_9_, user0_.lastUpdateAt as lastUpda8_9_, user0_.likeNumers as likeNumers9_, user0_.mobile as mobile9_, user0_.profileStatus as profile11_9_, user0_.profileStyle as profile12_9_, user0_.qqAccount as qqAccount9_, user0_.readTimes as readTimes9_, user0_.registerOn as registerOn9_, user0_.smallPhotoUrl as smallPh16_9_, user0_.subscribeOn as subscri17_9_, user0_.unsubscribeOn as unsubsc18_9_, user0_.userName as userName9_, user0_.weChatAccount as weChatA20_9_, user0_.weChatCity as weChatCity9_, user0_.weChatHeadImgUrl as weChatH22_9_, user0_.weChatNickName as weChatN23_9_, user0_.weChatOpenId as weChatO24_9_, user0_.weChatProvince as weChatP25_9_, user0_.weChatSex as weChatSex9_ from User user0_ where user0_.userId=? 2015-06-10 01:16:12 Loader 849 [DEBUG] Result set row: 0 2015-06-10 01:16:12 Loader 1344 [DEBUG] Result row: EntityKey[com.wp.pp.model.User#808809b1-6a66-4839-b619-7aaea276b995] 2015-06-10 01:16:12 TwoPhaseLoad 158 [DEBUG] Resolving associations for [com.wp.pp.model.User#808809b1-6a66-4839-b619-7aaea276b995] 2015-06-10 01:16:12 TwoPhaseLoad 297 [DEBUG] Done materializing entity [com.wp.pp.model.User#808809b1-6a66-4839-b619-7aaea276b995] 2015-06-10 01:16:12 StatefulPersistenceContext 947 [DEBUG] Initializing non-lazy collections 2015-06-10 01:16:12 EntityManagerFactoryUtils 435 [DEBUG] Closing JPA EntityManager 2015-06-10 01:16:12 LogicalConnectionImpl 314 [DEBUG] Releasing JDBC connection 2015-06-10 01:16:12 LogicalConnectionImpl 332 [DEBUG] Released JDBC connection 2015-06-10 01:16:12 ConnectionProxyHandler 219 [DEBUG] HHH000163: Logical connection releasing its physical connection 2015-06-10 01:16:12 WeChatSystemConfigService 95 [DEBUG] Get Access Token 2015-06-10 01:16:12 SharedEntityManagerCreator$SharedEntityManagerInvocationHandler 248 [DEBUG] Creating new EntityManager for shared EntityManager invocation 2015-06-10 01:16:12 SessionImpl 316 [DEBUG] Opened session at timestamp: 14338701723 2015-06-10 01:16:12 CriteriaQueryCompiler 219 [DEBUG] Rendered criteria query -> select generatedAlias0 from WeChatSystemConfig as generatedAlias0 where generatedAlias0.configItem=:param0 2015-06-10 01:16:12 LogicalConnectionImpl 295 [DEBUG] Obtaining JDBC connection 2015-06-10 01:16:12 LogicalConnectionImpl 301 [DEBUG] Obtained JDBC connection 2015-06-10 01:16:12 SQL 104 [DEBUG] select wechatsyst0_.id as id12_, wechatsyst0_.configItem as configItem12_, wechatsyst0_.configValue as configVa3_12_, wechatsyst0_.lastConfigAt as lastConf4_12_, wechatsyst0_.remark as remark12_ from WeChatSystemConfig wechatsyst0_ where wechatsyst0_.configItem=? limit ? 2015-06-10 01:16:12 Loader 849 [DEBUG] Result set row: 0 2015-06-10 01:16:12 Loader 1344 [DEBUG] Result row: EntityKey[com.wp.pp.model.WeChatSystemConfig#611a33fb-eb10-47eb-8941-a215f663359e] 2015-06-10 01:16:12 TwoPhaseLoad 158 [DEBUG] Resolving associations for [com.wp.pp.model.WeChatSystemConfig#611a33fb-eb10-47eb-8941-a215f663359e] 2015-06-10 01:16:12 TwoPhaseLoad 297 [DEBUG] Done materializing entity [com.wp.pp.model.WeChatSystemConfig#611a33fb-eb10-47eb-8941-a215f663359e] 2015-06-10 01:16:12 StatefulPersistenceContext 947 [DEBUG] Initializing non-lazy collections 2015-06-10 01:16:12 EntityManagerFactoryUtils 435 [DEBUG] Closing JPA EntityManager 2015-06-10 01:16:12 LogicalConnectionImpl 314 [DEBUG] Releasing JDBC connection 2015-06-10 01:16:12 LogicalConnectionImpl 332 [DEBUG] Released JDBC connection 2015-06-10 01:16:12 ConnectionProxyHandler 219 [DEBUG] HHH000163: Logical connection releasing its physical connection 2015-06-10 01:16:12 WeChatSystemConfigService 98 [DEBUG] Found 1 valid cache Access Token: DXY1gQD_EuemxX6TVEPTva52tXjTYSPbTglhgjAOUWV_oa2KZTgqWN_Y1Ps0asHKpMYtWmD0xB5qgQNsfkD_T44onQ-WFwt8pDeHRCsmNHU 2015-06-10 01:16:12 FileService 134 [DEBUG] fileName = PAtgTHiF5Yc9rWSTdViBlkRxSag8LoQ5uQZVsw6yRxPkTQjSjQvlNQRwkdvLzyw3.amr 2015-06-10 01:16:12 FileService 150 [DEBUG] ============================== 2015-06-10 01:16:12 FileService 151 [DEBUG] Voice file absolute path = /var/lib/tomcat/pp/media/o-d71s3oI_IoBZAzJoIvqMleeQVg/PAtgTHiF5Yc9rWSTdViBlkRxSag8LoQ5uQZVsw6yRxPkTQjSjQvlNQRwkdvLzyw3.amr 2015-06-10 01:16:12 FileService 153 [DEBUG] mp3TargetPath file absolute path = /var/lib/tomcat/pp/media/o-d71s3oI_IoBZAzJoIvqMleeQVg/PAtgTHiF5Yc9rWSTdViBlkRxSag8LoQ5uQZVsw6yRxPkTQjSjQvlNQRwkdvLzyw3.mp3 2015-06-10 01:16:12 FileService 154 [DEBUG] ============================== 2015-06-10 01:16:12 FileService 182 [DEBUG] MP3 - file path = /var/lib/tomcat/pp/media/o-d71s3oI_IoBZAzJoIvqMleeQVg/PAtgTHiF5Yc9rWSTdViBlkRxSag8LoQ5uQZVsw6yRxPkTQjSjQvlNQRwkdvLzyw3.mp3 2015-06-10 01:16:12 FileService 210 [ERROR] Duration: N/A, bitrate: N/A it.sauronsoftware.jave.EncoderException: Duration: N/A, bitrate: N/A at it.sauronsoftware.jave.Encoder.encode(Encoder.java:863) at it.sauronsoftware.jave.Encoder.encode(Encoder.java:713) at com.wp.pp.service.FileService.changeToMp3(FileService.java:204) at com.wp.pp.service.FileService.downloadFile(FileService.java:156) at com.wp.pp.web.controller.TemplateConfigController.downloadMedia(TemplateConfigController.java:803) at com.wp.pp.web.controller.TemplateConfigController.saveVisualizationConfig(TemplateConfigController.java:609) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:622) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:748) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:833) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:931) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:701) 2015-06-10 01:16:12 TemplateConfigController 804 [DEBUG] fileName = PAtgTHiF5Yc9rWSTdViBlkRxSag8LoQ5uQZVsw6yRxPkTQjSjQvlNQRwkdvLzyw3.amr 2015-06-10 01:16:12 TemplateConfigController 610 [DEBUG] voiceUrl = /media/o-d71s3oI_IoBZAzJoIvqMleeQVg/PAtgTHiF5Yc9rWSTdViBlkRxSag8LoQ5uQZVsw6yRxPkTQjSjQvlNQRwkdvLzyw3.amr 2015-06-10 01:16:12 DefaultListableBeanFactory 249 [DEBUG] Returning cached instance of singleton bean 'transactionManager' 2015-06-10 01:16:12 JpaTransactionManager 367 [DEBUG] Creating new transaction with name [com.wp.pp.service.VisualizationConfigService.save]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' 2015-06-10 01:16:12 SessionImpl 316 [DEBUG] Opened session at timestamp: 14338701724 2015-06-10 01:16:12 JpaTransactionManager 371 [DEBUG] Opened new EntityManager [org.hibernate.ejb.EntityManagerImpl@1b72966a] for JPA transaction 2015-06-10 01:16:12 AbstractTransactionImpl 158 [DEBUG] begin 2015-06-10 01:16:12 LogicalConnectionImpl 295 [DEBUG] Obtaining JDBC connection 2015-06-10 01:16:12 LogicalConnectionImpl 301 [DEBUG] Obtained JDBC connection 2015-06-10 01:16:12 JdbcTransaction 69 [DEBUG] initial autocommit status: true 2015-06-10 01:16:12 JdbcTransaction 71 [DEBUG] disabling autocommit 2015-06-10 01:16:12 JpaTransactionManager 403 [DEBUG] Exposing JPA transaction as JDBC transaction [org.springframework.orm.jpa.vendor.HibernateJpaDialect$HibernateConnectionHandle@49626430] 2015-06-10 01:16:12 DefaultListableBeanFactory 249 [DEBUG] Returning cached instance of singleton bean 'transactionManager' 2015-06-10 01:16:12 JpaTransactionManager 334 [DEBUG] Found thread-bound EntityManager [org.hibernate.ejb.EntityManagerImpl@1b72966a] for JPA transaction 2015-06-10 01:16:12 JpaTransactionManager 472 [DEBUG] Participating in existing transaction 2015-06-10 01:16:12 Loader 2021 [DEBUG] Loading entity: [com.wp.pp.model.User#808809b1-6a66-4839-b619-7aaea276b995] 2015-06-10 01:16:12 SQL 104 [DEBUG] select user0_.userId as userId9_0_, user0_.email as email9_0_, user0_.fullPhotoUrl as fullPhot3_9_0_, user0_.goodByAudioServerId as goodByAu4_9_0_, user0_.goodByeAudioUrl as goodByeA5_9_0_, user0_.introduceAudioUrl as introduc6_9_0_, user0_.isSubScribe as isSubScr7_9_0_, user0_.lastUpdateAt as lastUpda8_9_0_, user0_.likeNumers as likeNumers9_0_, user0_.mobile as mobile9_0_, user0_.profileStatus as profile11_9_0_, user0_.profileStyle as profile12_9_0_, user0_.qqAccount as qqAccount9_0_, user0_.readTimes as readTimes9_0_, user0_.registerOn as registerOn9_0_, user0_.smallPhotoUrl as smallPh16_9_0_, user0_.subscribeOn as subscri17_9_0_, user0_.unsubscribeOn as unsubsc18_9_0_, user0_.userName as userName9_0_, user0_.weChatAccount as weChatA20_9_0_, user0_.weChatCity as weChatCity9_0_, user0_.weChatHeadImgUrl as weChatH22_9_0_, user0_.weChatNickName as weChatN23_9_0_, user0_.weChatOpenId as weChatO24_9_0_, user0_.weChatProvince as weChatP25_9_0_, user0_.weChatSex as weChatSex9_0_ from User user0_ where user0_.userId=? 2015-06-10 01:16:12 Loader 849 [DEBUG] Result set row: 0 2015-06-10 01:16:12 Loader 1344 [DEBUG] Result row: EntityKey[com.wp.pp.model.User#808809b1-6a66-4839-b619-7aaea276b995] 2015-06-10 01:16:12 TwoPhaseLoad 158 [DEBUG] Resolving associations for [com.wp.pp.model.User#808809b1-6a66-4839-b619-7aaea276b995] 2015-06-10 01:16:12 TwoPhaseLoad 297 [DEBUG] Done materializing entity [com.wp.pp.model.User#808809b1-6a66-4839-b619-7aaea276b995] 2015-06-10 01:16:12 StatefulPersistenceContext 947 [DEBUG] Initializing non-lazy collections 2015-06-10 01:16:12 Loader 2045 [DEBUG] Done entity load 2015-06-10 01:16:12 DefaultListableBeanFactory 249 [DEBUG] Returning cached instance of singleton bean 'transactionManager' 2015-06-10 01:16:12 JpaTransactionManager 334 [DEBUG] Found thread-bound EntityManager [org.hibernate.ejb.EntityManagerImpl@1b72966a] for JPA transaction 2015-06-10 01:16:12 JpaTransactionManager 472 [DEBUG] Participating in existing transaction 2015-06-10 01:16:12 CriteriaQueryCompiler 219 [DEBUG] Rendered criteria query -> select generatedAlias0 from VisualizationConfig as generatedAlias0 where generatedAlias0.userId=:param0 2015-06-10 01:16:12 AbstractFlushingEventListener 143 [DEBUG] Processing flush-time cascades 2015-06-10 01:16:12 AbstractFlushingEventListener 183 [DEBUG] Dirty checking collections 2015-06-10 01:16:12 AbstractFlushingEventListener 117 [DEBUG] Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects 2015-06-10 01:16:12 AbstractFlushingEventListener 124 [DEBUG] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections 2015-06-10 01:16:12 EntityPrinter 114 [DEBUG] Listing entities: 2015-06-10 01:16:12 EntityPrinter 121 [DEBUG] com.wp.pp.model.User{unsubscribeOn=2015-06-02 23:45:35.0, weChatOpenId=o-d71s3oI_IoBZAzJoIvqMleeQVg, weChatNickName=???, registerOn=null, introduceAudioUrl=null, readTimes=0, profileStatus=draft, userId=808809b1-6a66-4839-b619-7aaea276b995, subscribeOn=2015-06-02 23:45:57.0, userName=???, fullPhotoUrl=null, goodByAudioServerId=0i7ReActqOPa45BxDRrypUpByBziGazkqDJSAmdg-1Cj3bIWfL5FZ4xgduiRPiEQ, weChatCity=??, lastUpdateAt=Wed Jun 10 01:16:12 CST 2015, likeNumers=92, weChatProvince=??, email=2, weChatSex=1, isSubScribe=true, weChatAccount=3, goodByeAudioUrl=/media/o-d71s3oI_IoBZAzJoIvqMleeQVg/0i7ReActqOPa45BxDRrypUpByBziGazkqDJSAmdg-1Cj3bIWfL5FZ4xgduiRPiEQ.amr, weChatHeadImgUrl=http://wx.qlogo.cn/mmopen/YUnE7hjiaRfC0RcRhAnUlKlwqia6VWT2pbwG14kArVjr67w5A1mnbG9w25WMDFCxSz6tO9QKr8WgzUXgwzLgKJNjGdQd4NnIGp/0, profileStyle=black, smallPhotoUrl=/media/o-d71s3oI_IoBZAzJoIvqMleeQVg/head.png?rand=139d2d49-1801-4bcc-b74b-ad772a0e4dcf, qqAccount=666, mobile=13510902180} 2015-06-10 01:16:12 SQL 104 [DEBUG] select visualizat0_.id as id11_, visualizat0_.lastUpdateAt as lastUpda2_11_, visualizat0_.photoUrl as photoUrl11_, visualizat0_.photoWeChatServerId as photoWeC4_11_, visualizat0_.userId as userId11_, visualizat0_.voiceUrl as voiceUrl11_, visualizat0_.voiceWeChatServerId as voiceWeC7_11_ from VisualizationConfig visualizat0_ where visualizat0_.userId=? limit ? 2015-06-10 01:16:12 Loader 849 [DEBUG] Result set row: 0 2015-06-10 01:16:12 Loader 1344 [DEBUG] Result row: EntityKey[com.wp.pp.model.VisualizationConfig#f6eda01e-b819-4ada-a1c5-5c31feb865d3] 2015-06-10 01:16:12 TwoPhaseLoad 158 [DEBUG] Resolving associations for [com.wp.pp.model.VisualizationConfig#f6eda01e-b819-4ada-a1c5-5c31feb865d3] 2015-06-10 01:16:12 TwoPhaseLoad 297 [DEBUG] Done materializing entity [com.wp.pp.model.VisualizationConfig#f6eda01e-b819-4ada-a1c5-5c31feb865d3]