Capture stderor output?
Hi
I am writting a script to do some conversions on a very large number of audio files. Using a small set of sample data I run the script and see two messages that i assume are from ffmpeg:
```
[pcm_f32le @ 000002824c7eb180] Invalid PCM packet, data has size 2 but at least a size of 8 was expected
[aist#0:0/pcm_f32le @ 000002824c7a0ec0] [dec:pcm_f32le @ 000002824c7eab00] Decoding error: Invalid data found when processing input
[pcm_f32le @ 000001643ca67c00] Invalid PCM packet, data has size 2 but at least a size of 4 was expected
[aist#0:0/pcm_f32le @ 000001643ca20ec0] [dec:pcm_f32le @ 000001643ca67680] Decoding error: Invalid data found when processing input
```
I am doing the following in my code:
```
try:
(
ffmpeg
.input(original)
.output(
copy,
acodec='pcm_s16le',
ac=1,
ar=16000,
loglevel='error',
af='aresample=osf=s16:dither_method=triangular_hp'
)
.overwrite_output() # Add this to overwrite the output file
.run()
)
except ffmpeg.Error as ex:
raise RuntimeError(repr(ex))
```
Is tthere a way to sense/capture the message output above so that i can identify which files generated the output?
关闭于 2025-09-04 1 条评论