使用ffmpeg将DTS转换为AAC,使语音音频向右移动

时间:2018-08-18 11:22:56

标签: ffmpeg

我正在使用ffmpeg将var polyLineShapeLayer:CAShapeLayer? var layerAdded = false var path = GMSPath() var polyLine:GMSPolyline! // Add regular polyline to the map func addPolyLineWithEncodedStringInMap(_ encodedString:String) { self.polyLine = GMSPolyline(path: self.path) polyLine.strokeWidth = 3.8 self.polyLine.strokeColor = .black polyLine.map = googleMapView DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 2) { self.addPolyLineShapeLayerToMapView() self.layerAdded = true } } // Add CAshapeLayer to map func layer(from path: GMSPath) -> CAShapeLayer { let breizerPath = UIBezierPath() let firstCoordinate: CLLocationCoordinate2D = path.coordinate(at: 0) breizerPath.move(to: self.googleMapView.projection.point(for: firstCoordinate)) for i in 1 ..< Int((path.count())){ print(path.coordinate(at: UInt(i))) let coordinate: CLLocationCoordinate2D = path.coordinate(at: UInt(i)) breizerPath.addLine(to: self.googleMapView.projection.point(for: coordinate)) } let shapeLayer = CAShapeLayer() shapeLayer.path = breizerPath.cgPath shapeLayer.strokeColor = UIColor.lightGray.withAlphaComponent(0.8).cgColor shapeLayer.lineWidth = 4.0 shapeLayer.fillColor = UIColor.clear.cgColor shapeLayer.lineJoin = kCALineJoinRound shapeLayer.lineCap = kCALineCapRound shapeLayer.cornerRadius = 5 return shapeLayer } func animatePath(_ layer: CAShapeLayer) { let pathAnimation = CABasicAnimation(keyPath: "strokeEnd") pathAnimation.duration = 2 pathAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) pathAnimation.fromValue = Int(0.0) pathAnimation.toValue = Int(1.0) pathAnimation.repeatCount = 200 layer.add(pathAnimation, forKey: "strokeEnd") } func addPolyLineShapeLayerToMapView(){ polyLineShapeLayer = self.layer(from: self.path) if let polyLineShapeLayer = polyLineShapeLayer{ self.animatePath(polyLineShapeLayer) self.googleMapView.layer.addSublayer(polyLineShapeLayer) polyLineShapeLayer.zPosition = 0 } } // Delegate methods to control the polyline // whenever map is about to move, if layer is already added, remove the layer from superLayer func mapView(_ mapView: GMSMapView, willMove gesture: Bool) { if layerAdded{ DispatchQueue.main.async { self.polyLineShapeLayer?.removeFromSuperlayer() self.polyLineShapeLayer = nil } } } // when map is idle again(var layerAdded:bool ensures that additional layer is not added initially when the delegate method is fired) add new instance of polylineShapeLayer to the map with current projected coordinates. func mapView(_ mapView: GMSMapView, idleAt position: GMSCameraPosition) { if self.layerAdded{ self.addPolyLineShapeLayerToMapView() } } 电影转换为mkv,就像这样:

mp4

这样做,音频流将从原始DTS转换为

$ ffmpeg -i source.mkv -c:v copy -c:a aac destination.mp4

致AAC:

Stream #0:1: Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)

通过MacBook的内置扬声器或我的笔记本电脑收听时,口头音频(我假设将以5.1配置发送到中央声道)的声音明显向右偏移,结果文件播放得很好立体声耳机。请注意,音乐和其他声音效果似乎不会受到影响,并且保持适当的平衡。另外请注意,我已经能够使用各种源文件来重现此行为。

这是ffmpeg的横幅:

Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 394 kb/s (default)

1 个答案:

答案 0 :(得分:1)

2017年11月,FFmpeg提交aacenc: support extended channel layouts using PCEs添加了对比AAC的MPEG标准所指定的更多通道布局的支持。不幸的是,它似乎已经破坏了以前可以正常使用的布局的编码。

3.4版本系列是上述提交之前的最后一个版本,如果您在使用最新版本时遇到错误,则应将其用于多通道AAC编码。

https://trac.ffmpeg.org/ticket/7273上有一个打开的错误报告。您可以在此处发表评论以展示您的示例。