8000 added mono to stereo example · Powercoder64/ffmpeg-python@c99e97b · GitHub
[go: up one dir, main page]

Skip to content

Commit c99e97b

Browse files
committed
added mono to stereo example
1 parent 78fb6cf commit c99e97b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

examples/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,36 @@ out = ffmpeg.output(v3, a3, 'out.mp4')
115115
out.run()
116116
```
117117

118+
## Mono to stereo with offsets and video
119+
120+
<img src="https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/examples/graphs/mono-to-stereo.png" alt="mono-to-stereo graph" width="80%" />
121+
122+
```python
123+
audio_left = (
124+
ffmpeg
125+
.input('audio-left.wav')
126+
.filter('atrim', start=5)
127+
.filter('asetpts', 'PTS-STARTPTS')
128+
)
129+
130+
audio_right = (
131+
ffmpeg
132+
.input('audio-right.wav')
133+
.filter('atrim', start=10)
134+
.filter('asetpts', 'PTS-STARTPTS')
135+
)
136+
137+
input_video = ffmpeg.input('input-video.mp4')
138+
139+
(
140+
ffmpeg
141+
.filter((audio_left, audio_right), 'join', inputs=2, channel_layout='stereo')
142+
.output(input_video.video, 'output-video.mp4', shortest=None, vcodec='copy')
143+
.overwrite_output()
144+
.run()
145+
)
146+
```
147+
118148
## [Jupyter Frame Viewer](https://github.com/kkroening/ffmpeg-python/blob/master/examples/ffmpeg-numpy.ipynb)
119149

120150
<img src="https://raw.githubusercontent.com/kkroening/ffmpeg-python/master/doc/jupyter-screenshot.png" alt="jupyter screenshot" width="75%" />

examples/graphs/mono-to-stereo.png

16.8 KB
Loading

0 commit comments

Comments
 (0)
0