af_silenceremove timestamp copy option doesn't seem to work
Hello! I am trying to use the *silenceremove *filter as explained in the ffmpeg documentation. <https://ffmpeg.org/ffmpeg-filters.html#toc-silenceremove> I wanted to keep the original timestamps from the modified audio file with the *timestamp=copy *option. The silence is removed as expected, but after running *ashowinfo*, the original timestamps seem to have been modified. In fact, regardless of *timestamp=copy *and *timestamp=write*, there is no difference in the *pts* output values. I might be misunderstanding how it works though, so I wanted to double check here. Here is what I did. 1. Downloaded a sample sound with multiple silences. This is the sound <https://freesound.org/people/frosthardr/sounds/253067/> I used. I named it *in.wav*. If you take a look at the waveform, there are 4 pulses of sound that last roughly 2.5 seconds, with about 1 second of silence between each one (the entire audio clip is roughly 15 seconds). 2. I used the following command to generate an output with copied timestamps: *Command:* *ffmpeg -y -i ~/files/test_ffmpeg/in.wav -filter_complex silenceremove=stop_periods=-1:timestamp=copy:stop_threshold=-30dB ~/files/test_ffmpeg/out_copy.wav* * Output:* *ffmpeg version N-118350-ge20ee9f9ae Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04) configuration: --prefix=/home/justin/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/justin/ffmpeg_build/include --extra-ldflags=-L/home/justin/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/justin/bin --enable-gpl --enable-gnutls --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-nonfree libavutil 59. 55.100 / 59. 55.100 libavcodec 61. 31.101 / 61. 31.101 libavformat 61. 9.106 / 61. 9.106 libavdevice 61. 4.100 / 61. 4.100 libavfilter 10. 6.101 / 10. 6.101 libswscale 8. 13.100 / 8. 13.100 libswresample 5. 4.100 / 5. 4.100 libpostproc 58. 4.100 / 58. 4.100 [aist#0:0/pcm_s16le @ 0x5621b0ab7a40] Guessed Channel Layout: stereo Input #0, wav, from '/home/justin/files/test_ffmpeg/in.wav': Metadata: title : Electronic Drum Loop 01 artist : Matech comment : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> Duration: 00:00:15.24, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 (pcm_s16le) -> silenceremove:default silenceremove:default -> Stream #0:0 (pcm_s16le) Press [q] to stop, [?] for help Output #0, wav, to '/home/justin/files/test_ffmpeg/out_copy.wav': Metadata: INAM : Electronic Drum Loop 01 IART : Matech ICMT : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> ISFT : Lavf61.9.106 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Metadata: encoder : Lavc61.31.101 pcm_s16le [out#0/wav @ 0x5621b0ab9e00] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.014075% size= 1110KiB time=00:00:13.28 bitrate= 684.7kbits/s speed= 459x * 3. I also generated an output with overwritten timestamps: *Command:* *ffmpeg -y -i ~/files/test_ffmpeg/in.wav -filter_complex silenceremove=stop_periods=-1:timestamp=write:stop_threshold=-30dB ~/files/test_ffmpeg/out_write.wav* *Output:* *ffmpeg version N-118350-ge20ee9f9ae Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04) configuration: --prefix=/home/justin/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/justin/ffmpeg_build/include --extra-ldflags=-L/home/justin/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/justin/bin --enable-gpl --enable-gnutls --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-nonfree libavutil 59. 55.100 / 59. 55.100 libavcodec 61. 31.101 / 61. 31.101 libavformat 61. 9.106 / 61. 9.106 libavdevice 61. 4.100 / 61. 4.100 libavfilter 10. 6.101 / 10. 6.101 libswscale 8. 13.100 / 8. 13.100 libswresample 5. 4.100 / 5. 4.100 libpostproc 58. 4.100 / 58. 4.100 [aist#0:0/pcm_s16le @ 0x5c514279ea40] Guessed Channel Layout: stereo Input #0, wav, from '/home/justin/files/test_ffmpeg/in.wav': Metadata: title : Electronic Drum Loop 01 artist : Matech comment : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> Duration: 00:00:15.24, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 (pcm_s16le) -> silenceremove:default silenceremove:default -> Stream #0:0 (pcm_s16le) Press [q] to stop, [?] for help Output #0, wav, to '/home/justin/files/test_ffmpeg/out_write.wav': Metadata: INAM : Electronic Drum Loop 01 IART : Matech ICMT : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> ISFT : Lavf61.9.106 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Metadata: encoder : Lavc61.31.101 pcm_s16le [out#0/wav @ 0x5c51427a0e00] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.014075% size= 1110KiB time=00:00:06.44 bitrate=1411.4kbits/s speed= 227x * 4. I then ran the following commands to get the timestamp output for each of the above files. See the attached files since the output was too long to paste here. *ffmpeg -i ~/files/test_ffmpeg/in.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/in_ashowinfo.txt* *ffmpeg -i ~/files/test_ffmpeg/out_copy.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/out_copy_ashowinfo.txt* *ffmpeg -i ~/files/test_ffmpeg/out_write.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/out_write_ashowinfo.txt* Here are the ends of the files to explain the issue: *in_ashowinfo.txt * *[Parsed_ashowinfo_0 @ 0x72aa280025c0] n:160 pts:655360 pts_time:14.860771 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:BFC63EA4 plane_checksums: [ BFC63EA4 ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:161 pts:659456 pts_time:14.953651 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:44D92A6E plane_checksums: [ 44D92A6E ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:162 pts:663552 pts_time:15.046531 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:071FC31C plane_checksums: [ 071FC31C ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:163 pts:667648 pts_time:15.13941 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:AD15BC98 plane_checksums: [ AD15BC98 ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:164 pts:671744 pts_time:15.23229 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:256 checksum:00000000 plane_checksums: [ 00000000 ][out#0/null @ 0x5a0bc0b35440] video:0KiB audio:2625KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknownsize=N/A time=00:00:15.23 bitrate=N/A speed=1.81e+03x * *out_copy_ashowinfo.txt * *[Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:64 pts:262144 pts_time:5.944308 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:340B4DDC plane_checksums: [ 340B4DDC ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:65 pts:266240 pts_time:6.037188 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:F2148934 plane_checksums: [ F2148934 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:66 pts:270336 pts_time:6.130068 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:F374BB67 plane_checksums: [ F374BB67 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:67 pts:274432 pts_time:6.222948 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:570F8385 plane_checksums: [ 570F8385 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:68 pts:278528 pts_time:6.315828 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:0983C2F7 plane_checksums: [ 0983C2F7 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:69 pts:282624 pts_time:6.408707 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:1560 checksum:017E3AB0 plane_checksums: [ 017E3AB0 ][out#0/null @ 0x61dc2756bac0] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknownsize=N/A time=00:00:06.44 bitrate=N/A speed=1.99e+03x * Based on the waveform, the *out_copy_ashowinfo.txt *says the last timestamp is roughly 6 seconds, but if the original timestamps were maintained then it should be roughly 11 seconds, since this is when the last pulse of audio is played. I would expect there to be gaps in the timestamps which correspond to the removed silence but there isn't. Also note that the contents of *out_write_ashowinfo.txt *is identical to *out_copy_ashowinfo.txt*, so the option doesn't seem to do anything. Thanks all for your help! -Justin
wav format container does not store timestamps at all. Filter works fine. On Sat, Jan 25, 2025 at 4:42 AM Justin <justinrsilver@gmail.com> wrote:
Hello!
I am trying to use the *silenceremove *filter as explained in the ffmpeg documentation. <https://ffmpeg.org/ffmpeg-filters.html#toc-silenceremove> I wanted to keep the original timestamps from the modified audio file with the *timestamp=copy *option. The silence is removed as expected, but after running *ashowinfo*, the original timestamps seem to have been modified. In fact, regardless of *timestamp=copy *and *timestamp=write*, there is no difference in the *pts* output values. I might be misunderstanding how it works though, so I wanted to double check here.
Here is what I did.
1. Downloaded a sample sound with multiple silences. This is the sound <https://freesound.org/people/frosthardr/sounds/253067/> I used. I named it *in.wav*. If you take a look at the waveform, there are 4 pulses of sound that last roughly 2.5 seconds, with about 1 second of silence between each one (the entire audio clip is roughly 15 seconds).
2. I used the following command to generate an output with copied timestamps:
*Command:* *ffmpeg -y -i ~/files/test_ffmpeg/in.wav -filter_complex silenceremove=stop_periods=-1:timestamp=copy:stop_threshold=-30dB ~/files/test_ffmpeg/out_copy.wav*
* Output:*
*ffmpeg version N-118350-ge20ee9f9ae Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04) configuration: --prefix=/home/justin/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/justin/ffmpeg_build/include --extra-ldflags=-L/home/justin/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/justin/bin --enable-gpl --enable-gnutls --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-nonfree libavutil 59. 55.100 / 59. 55.100 libavcodec 61. 31.101 / 61. 31.101 libavformat 61. 9.106 / 61. 9.106 libavdevice 61. 4.100 / 61. 4.100 libavfilter 10. 6.101 / 10. 6.101 libswscale 8. 13.100 / 8. 13.100 libswresample 5. 4.100 / 5. 4.100 libpostproc 58. 4.100 / 58. 4.100 [aist#0:0/pcm_s16le @ 0x5621b0ab7a40] Guessed Channel Layout: stereo Input #0, wav, from '/home/justin/files/test_ffmpeg/in.wav': Metadata: title : Electronic Drum Loop 01 artist : Matech comment : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> Duration: 00:00:15.24, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 (pcm_s16le) -> silenceremove:default silenceremove:default -> Stream #0:0 (pcm_s16le) Press [q] to stop, [?] for help Output #0, wav, to '/home/justin/files/test_ffmpeg/out_copy.wav': Metadata: INAM : Electronic Drum Loop 01 IART : Matech ICMT : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> ISFT : Lavf61.9.106 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Metadata: encoder : Lavc61.31.101 pcm_s16le [out#0/wav @ 0x5621b0ab9e00] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.014075% size= 1110KiB time=00:00:13.28 bitrate= 684.7kbits/s speed= 459x *
3. I also generated an output with overwritten timestamps:
*Command:* *ffmpeg -y -i ~/files/test_ffmpeg/in.wav -filter_complex silenceremove=stop_periods=-1:timestamp=write:stop_threshold=-30dB ~/files/test_ffmpeg/out_write.wav*
*Output:*
*ffmpeg version N-118350-ge20ee9f9ae Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04) configuration: --prefix=/home/justin/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/justin/ffmpeg_build/include --extra-ldflags=-L/home/justin/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/justin/bin --enable-gpl --enable-gnutls --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-nonfree libavutil 59. 55.100 / 59. 55.100 libavcodec 61. 31.101 / 61. 31.101 libavformat 61. 9.106 / 61. 9.106 libavdevice 61. 4.100 / 61. 4.100 libavfilter 10. 6.101 / 10. 6.101 libswscale 8. 13.100 / 8. 13.100 libswresample 5. 4.100 / 5. 4.100 libpostproc 58. 4.100 / 58. 4.100 [aist#0:0/pcm_s16le @ 0x5c514279ea40] Guessed Channel Layout: stereo Input #0, wav, from '/home/justin/files/test_ffmpeg/in.wav': Metadata: title : Electronic Drum Loop 01 artist : Matech comment : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> Duration: 00:00:15.24, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 (pcm_s16le) -> silenceremove:default silenceremove:default -> Stream #0:0 (pcm_s16le) Press [q] to stop, [?] for help Output #0, wav, to '/home/justin/files/test_ffmpeg/out_write.wav': Metadata: INAM : Electronic Drum Loop 01 IART : Matech ICMT : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> ISFT : Lavf61.9.106 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Metadata: encoder : Lavc61.31.101 pcm_s16le [out#0/wav @ 0x5c51427a0e00] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.014075% size= 1110KiB time=00:00:06.44 bitrate=1411.4kbits/s speed= 227x *
4. I then ran the following commands to get the timestamp output for each of the above files. See the attached files since the output was too long to paste here.
*ffmpeg -i ~/files/test_ffmpeg/in.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/in_ashowinfo.txt* *ffmpeg -i ~/files/test_ffmpeg/out_copy.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/out_copy_ashowinfo.txt* *ffmpeg -i ~/files/test_ffmpeg/out_write.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/out_write_ashowinfo.txt*
Here are the ends of the files to explain the issue:
*in_ashowinfo.txt *
*[Parsed_ashowinfo_0 @ 0x72aa280025c0] n:160 pts:655360 pts_time:14.860771 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:BFC63EA4 plane_checksums: [ BFC63EA4 ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:161 pts:659456 pts_time:14.953651 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:44D92A6E plane_checksums: [ 44D92A6E ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:162 pts:663552 pts_time:15.046531 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:071FC31C plane_checksums: [ 071FC31C ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:163 pts:667648 pts_time:15.13941 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:AD15BC98 plane_checksums: [ AD15BC98 ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:164 pts:671744 pts_time:15.23229 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:256 checksum:00000000 plane_checksums: [ 00000000 ][out#0/null @ 0x5a0bc0b35440] video:0KiB audio:2625KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknownsize=N/A time=00:00:15.23 bitrate=N/A speed=1.81e+03x *
*out_copy_ashowinfo.txt *
*[Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:64 pts:262144 pts_time:5.944308 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:340B4DDC plane_checksums: [ 340B4DDC ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:65 pts:266240 pts_time:6.037188 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:F2148934 plane_checksums: [ F2148934 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:66 pts:270336 pts_time:6.130068 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:F374BB67 plane_checksums: [ F374BB67 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:67 pts:274432 pts_time:6.222948 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:570F8385 plane_checksums: [ 570F8385 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:68 pts:278528 pts_time:6.315828 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:0983C2F7 plane_checksums: [ 0983C2F7 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:69 pts:282624 pts_time:6.408707 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:1560 checksum:017E3AB0 plane_checksums: [ 017E3AB0 ][out#0/null @ 0x61dc2756bac0] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknownsize=N/A time=00:00:06.44 bitrate=N/A speed=1.99e+03x *
Based on the waveform, the *out_copy_ashowinfo.txt *says the last timestamp is roughly 6 seconds, but if the original timestamps were maintained then it should be roughly 11 seconds, since this is when the last pulse of audio is played. I would expect there to be gaps in the timestamps which correspond to the removed silence but there isn't. Also note that the contents of *out_write_ashowinfo.txt *is identical to *out_copy_ashowinfo.txt*, so the option doesn't seem to do anything.
Thanks all for your help! -Justin _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
Define "timestamps" in this context? I've seen wave files that can store various types of marker. P On Saturday 25 January 2025 at 09:37:39 GMT, Paul B Mahol <onemda@gmail.com> wrote: wav format container does not store timestamps at all. Filter works fine. On Sat, Jan 25, 2025 at 4:42 AM Justin <justinrsilver@gmail.com> wrote:
Hello!
I am trying to use the *silenceremove *filter as explained in the ffmpeg documentation. <https://ffmpeg.org/ffmpeg-filters.html#toc-silenceremove> I wanted to keep the original timestamps from the modified audio file with the *timestamp=copy *option. The silence is removed as expected, but after running *ashowinfo*, the original timestamps seem to have been modified. In fact, regardless of *timestamp=copy *and *timestamp=write*, there is no difference in the *pts* output values. I might be misunderstanding how it works though, so I wanted to double check here.
Here is what I did.
1. Downloaded a sample sound with multiple silences. This is the sound <https://freesound.org/people/frosthardr/sounds/253067/> I used. I named it *in.wav*. If you take a look at the waveform, there are 4 pulses of sound that last roughly 2.5 seconds, with about 1 second of silence between each one (the entire audio clip is roughly 15 seconds).
2. I used the following command to generate an output with copied timestamps:
*Command:* *ffmpeg -y -i ~/files/test_ffmpeg/in.wav -filter_complex silenceremove=stop_periods=-1:timestamp=copy:stop_threshold=-30dB ~/files/test_ffmpeg/out_copy.wav*
* Output:*
*ffmpeg version N-118350-ge20ee9f9ae Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04) configuration: --prefix=/home/justin/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/justin/ffmpeg_build/include --extra-ldflags=-L/home/justin/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/justin/bin --enable-gpl --enable-gnutls --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-nonfree libavutil 59. 55.100 / 59. 55.100 libavcodec 61. 31.101 / 61. 31.101 libavformat 61. 9.106 / 61. 9.106 libavdevice 61. 4.100 / 61. 4.100 libavfilter 10. 6.101 / 10. 6.101 libswscale 8. 13.100 / 8. 13.100 libswresample 5. 4.100 / 5. 4.100 libpostproc 58. 4.100 / 58. 4.100 [aist#0:0/pcm_s16le @ 0x5621b0ab7a40] Guessed Channel Layout: stereo Input #0, wav, from '/home/justin/files/test_ffmpeg/in.wav': Metadata: title : Electronic Drum Loop 01 artist : Matech comment : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> Duration: 00:00:15.24, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 (pcm_s16le) -> silenceremove:default silenceremove:default -> Stream #0:0 (pcm_s16le) Press [q] to stop, [?] for help Output #0, wav, to '/home/justin/files/test_ffmpeg/out_copy.wav': Metadata: INAM : Electronic Drum Loop 01 IART : Matech ICMT : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> ISFT : Lavf61.9.106 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Metadata: encoder : Lavc61.31.101 pcm_s16le [out#0/wav @ 0x5621b0ab9e00] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.014075% size= 1110KiB time=00:00:13.28 bitrate= 684.7kbits/s speed= 459x *
3. I also generated an output with overwritten timestamps:
*Command:* *ffmpeg -y -i ~/files/test_ffmpeg/in.wav -filter_complex silenceremove=stop_periods=-1:timestamp=write:stop_threshold=-30dB ~/files/test_ffmpeg/out_write.wav*
*Output:*
*ffmpeg version N-118350-ge20ee9f9ae Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04) configuration: --prefix=/home/justin/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/justin/ffmpeg_build/include --extra-ldflags=-L/home/justin/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/justin/bin --enable-gpl --enable-gnutls --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-nonfree libavutil 59. 55.100 / 59. 55.100 libavcodec 61. 31.101 / 61. 31.101 libavformat 61. 9.106 / 61. 9.106 libavdevice 61. 4.100 / 61. 4.100 libavfilter 10. 6.101 / 10. 6.101 libswscale 8. 13.100 / 8. 13.100 libswresample 5. 4.100 / 5. 4.100 libpostproc 58. 4.100 / 58. 4.100 [aist#0:0/pcm_s16le @ 0x5c514279ea40] Guessed Channel Layout: stereo Input #0, wav, from '/home/justin/files/test_ffmpeg/in.wav': Metadata: title : Electronic Drum Loop 01 artist : Matech comment : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> Duration: 00:00:15.24, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 (pcm_s16le) -> silenceremove:default silenceremove:default -> Stream #0:0 (pcm_s16le) Press [q] to stop, [?] for help Output #0, wav, to '/home/justin/files/test_ffmpeg/out_write.wav': Metadata: INAM : Electronic Drum Loop 01 IART : Matech ICMT : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> ISFT : Lavf61.9.106 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Metadata: encoder : Lavc61.31.101 pcm_s16le [out#0/wav @ 0x5c51427a0e00] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.014075% size= 1110KiB time=00:00:06.44 bitrate=1411.4kbits/s speed= 227x *
4. I then ran the following commands to get the timestamp output for each of the above files. See the attached files since the output was too long to paste here.
*ffmpeg -i ~/files/test_ffmpeg/in.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/in_ashowinfo.txt* *ffmpeg -i ~/files/test_ffmpeg/out_copy.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/out_copy_ashowinfo.txt* *ffmpeg -i ~/files/test_ffmpeg/out_write.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/out_write_ashowinfo.txt*
Here are the ends of the files to explain the issue:
*in_ashowinfo.txt *
*[Parsed_ashowinfo_0 @ 0x72aa280025c0] n:160 pts:655360 pts_time:14.860771 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:BFC63EA4 plane_checksums: [ BFC63EA4 ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:161 pts:659456 pts_time:14.953651 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:44D92A6E plane_checksums: [ 44D92A6E ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:162 pts:663552 pts_time:15.046531 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:071FC31C plane_checksums: [ 071FC31C ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:163 pts:667648 pts_time:15.13941 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:AD15BC98 plane_checksums: [ AD15BC98 ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:164 pts:671744 pts_time:15.23229 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:256 checksum:00000000 plane_checksums: [ 00000000 ][out#0/null @ 0x5a0bc0b35440] video:0KiB audio:2625KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknownsize=N/A time=00:00:15.23 bitrate=N/A speed=1.81e+03x *
*out_copy_ashowinfo.txt *
*[Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:64 pts:262144 pts_time:5.944308 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:340B4DDC plane_checksums: [ 340B4DDC ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:65 pts:266240 pts_time:6.037188 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:F2148934 plane_checksums: [ F2148934 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:66 pts:270336 pts_time:6.130068 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:F374BB67 plane_checksums: [ F374BB67 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:67 pts:274432 pts_time:6.222948 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:570F8385 plane_checksums: [ 570F8385 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:68 pts:278528 pts_time:6.315828 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:0983C2F7 plane_checksums: [ 0983C2F7 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:69 pts:282624 pts_time:6.408707 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:1560 checksum:017E3AB0 plane_checksums: [ 017E3AB0 ][out#0/null @ 0x61dc2756bac0] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknownsize=N/A time=00:00:06.44 bitrate=N/A speed=1.99e+03x *
Based on the waveform, the *out_copy_ashowinfo.txt *says the last timestamp is roughly 6 seconds, but if the original timestamps were maintained then it should be roughly 11 seconds, since this is when the last pulse of audio is played. I would expect there to be gaps in the timestamps which correspond to the removed silence but there isn't. Also note that the contents of *out_write_ashowinfo.txt *is identical to *out_copy_ashowinfo.txt*, so the option doesn't seem to do anything.
Thanks all for your help! -Justin _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
On 25 Jan 2025, at 20:36, Phil Rhodes via ffmpeg-user <ffmpeg-user@ffmpeg.org> wrote:
Define "timestamps" in this context?
I think he’s referring to the BWF samples after midnight, either in the Bext or iXML chunk. Bouke videotoolshed.com Van Oldenbarneveltstraat 33 6512 AS Nijmegen, the Netherlands +31 6 21817248 If you want to send me large files, please use: https://videotoolshed.wetransfer.com/
I've seen wave files that can store various types of marker. P On Saturday 25 January 2025 at 09:37:39 GMT, Paul B Mahol <onemda@gmail.com> wrote:
wav format container does not store timestamps at all. Filter works fine.
On Sat, Jan 25, 2025 at 4:42 AM Justin <justinrsilver@gmail.com> wrote:
Hello!
I am trying to use the *silenceremove *filter as explained in the ffmpeg documentation. <https://ffmpeg.org/ffmpeg-filters.html#toc-silenceremove> I wanted to keep the original timestamps from the modified audio file with the *timestamp=copy *option. The silence is removed as expected, but after running *ashowinfo*, the original timestamps seem to have been modified. In fact, regardless of *timestamp=copy *and *timestamp=write*, there is no difference in the *pts* output values. I might be misunderstanding how it works though, so I wanted to double check here.
Here is what I did.
1. Downloaded a sample sound with multiple silences. This is the sound <https://freesound.org/people/frosthardr/sounds/253067/> I used. I named it *in.wav*. If you take a look at the waveform, there are 4 pulses of sound that last roughly 2.5 seconds, with about 1 second of silence between each one (the entire audio clip is roughly 15 seconds).
2. I used the following command to generate an output with copied timestamps:
*Command:* *ffmpeg -y -i ~/files/test_ffmpeg/in.wav -filter_complex silenceremove=stop_periods=-1:timestamp=copy:stop_threshold=-30dB ~/files/test_ffmpeg/out_copy.wav*
* Output:*
*ffmpeg version N-118350-ge20ee9f9ae Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04) configuration: --prefix=/home/justin/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/justin/ffmpeg_build/include --extra-ldflags=-L/home/justin/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/justin/bin --enable-gpl --enable-gnutls --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-nonfree libavutil 59. 55.100 / 59. 55.100 libavcodec 61. 31.101 / 61. 31.101 libavformat 61. 9.106 / 61. 9.106 libavdevice 61. 4.100 / 61. 4.100 libavfilter 10. 6.101 / 10. 6.101 libswscale 8. 13.100 / 8. 13.100 libswresample 5. 4.100 / 5. 4.100 libpostproc 58. 4.100 / 58. 4.100 [aist#0:0/pcm_s16le @ 0x5621b0ab7a40] Guessed Channel Layout: stereo Input #0, wav, from '/home/justin/files/test_ffmpeg/in.wav': Metadata: title : Electronic Drum Loop 01 artist : Matech comment : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> Duration: 00:00:15.24, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 (pcm_s16le) -> silenceremove:default silenceremove:default -> Stream #0:0 (pcm_s16le) Press [q] to stop, [?] for help Output #0, wav, to '/home/justin/files/test_ffmpeg/out_copy.wav': Metadata: INAM : Electronic Drum Loop 01 IART : Matech ICMT : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> ISFT : Lavf61.9.106 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Metadata: encoder : Lavc61.31.101 pcm_s16le [out#0/wav @ 0x5621b0ab9e00] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.014075% size= 1110KiB time=00:00:13.28 bitrate= 684.7kbits/s speed= 459x *
3. I also generated an output with overwritten timestamps:
*Command:* *ffmpeg -y -i ~/files/test_ffmpeg/in.wav -filter_complex silenceremove=stop_periods=-1:timestamp=write:stop_threshold=-30dB ~/files/test_ffmpeg/out_write.wav*
*Output:*
*ffmpeg version N-118350-ge20ee9f9ae Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04) configuration: --prefix=/home/justin/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/justin/ffmpeg_build/include --extra-ldflags=-L/home/justin/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/justin/bin --enable-gpl --enable-gnutls --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-nonfree libavutil 59. 55.100 / 59. 55.100 libavcodec 61. 31.101 / 61. 31.101 libavformat 61. 9.106 / 61. 9.106 libavdevice 61. 4.100 / 61. 4.100 libavfilter 10. 6.101 / 10. 6.101 libswscale 8. 13.100 / 8. 13.100 libswresample 5. 4.100 / 5. 4.100 libpostproc 58. 4.100 / 58. 4.100 [aist#0:0/pcm_s16le @ 0x5c514279ea40] Guessed Channel Layout: stereo Input #0, wav, from '/home/justin/files/test_ffmpeg/in.wav': Metadata: title : Electronic Drum Loop 01 artist : Matech comment : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> Duration: 00:00:15.24, bitrate: 1411 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping: Stream #0:0 (pcm_s16le) -> silenceremove:default silenceremove:default -> Stream #0:0 (pcm_s16le) Press [q] to stop, [?] for help Output #0, wav, to '/home/justin/files/test_ffmpeg/out_write.wav': Metadata: INAM : Electronic Drum Loop 01 IART : Matech ICMT : soundcloud.com/matech-1/ <http://soundcloud.com/matech-1/> ISFT : Lavf61.9.106 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Metadata: encoder : Lavc61.31.101 pcm_s16le [out#0/wav @ 0x5c51427a0e00] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.014075% size= 1110KiB time=00:00:06.44 bitrate=1411.4kbits/s speed= 227x *
4. I then ran the following commands to get the timestamp output for each of the above files. See the attached files since the output was too long to paste here.
*ffmpeg -i ~/files/test_ffmpeg/in.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/in_ashowinfo.txt* *ffmpeg -i ~/files/test_ffmpeg/out_copy.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/out_copy_ashowinfo.txt* *ffmpeg -i ~/files/test_ffmpeg/out_write.wav -filter_complex ashowinfo -f null - 2> ~/files/test_ffmpeg/out_write_ashowinfo.txt*
Here are the ends of the files to explain the issue:
*in_ashowinfo.txt *
*[Parsed_ashowinfo_0 @ 0x72aa280025c0] n:160 pts:655360 pts_time:14.860771 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:BFC63EA4 plane_checksums: [ BFC63EA4 ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:161 pts:659456 pts_time:14.953651 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:44D92A6E plane_checksums: [ 44D92A6E ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:162 pts:663552 pts_time:15.046531 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:071FC31C plane_checksums: [ 071FC31C ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:163 pts:667648 pts_time:15.13941 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:AD15BC98 plane_checksums: [ AD15BC98 ][Parsed_ashowinfo_0 @ 0x72aa280025c0] n:164 pts:671744 pts_time:15.23229 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:256 checksum:00000000 plane_checksums: [ 00000000 ][out#0/null @ 0x5a0bc0b35440] video:0KiB audio:2625KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknownsize=N/A time=00:00:15.23 bitrate=N/A speed=1.81e+03x *
*out_copy_ashowinfo.txt *
*[Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:64 pts:262144 pts_time:5.944308 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:340B4DDC plane_checksums: [ 340B4DDC ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:65 pts:266240 pts_time:6.037188 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:F2148934 plane_checksums: [ F2148934 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:66 pts:270336 pts_time:6.130068 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:F374BB67 plane_checksums: [ F374BB67 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:67 pts:274432 pts_time:6.222948 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:570F8385 plane_checksums: [ 570F8385 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:68 pts:278528 pts_time:6.315828 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:4096 checksum:0983C2F7 plane_checksums: [ 0983C2F7 ][Parsed_ashowinfo_0 @ 0x7fc9fc0025c0] n:69 pts:282624 pts_time:6.408707 fmt:s16 channels:2 chlayout:stereo rate:44100 nb_samples:1560 checksum:017E3AB0 plane_checksums: [ 017E3AB0 ][out#0/null @ 0x61dc2756bac0] video:0KiB audio:1110KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknownsize=N/A time=00:00:06.44 bitrate=N/A speed=1.99e+03x *
Based on the waveform, the *out_copy_ashowinfo.txt *says the last timestamp is roughly 6 seconds, but if the original timestamps were maintained then it should be roughly 11 seconds, since this is when the last pulse of audio is played. I would expect there to be gaps in the timestamps which correspond to the removed silence but there isn't. Also note that the contents of *out_write_ashowinfo.txt *is identical to *out_copy_ashowinfo.txt*, so the option doesn't seem to do anything.
Thanks all for your help! -Justin _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
participants (4)
-
Bouke / Videotoolshed -
Justin -
Paul B Mahol -
Phil Rhodes