ffmpeg strftime no effect on windows
Asked Answered
T

1

2

I'm trying to auto mark the output file with timestamps with ffmpeg. Here's my test cmd:

.\ffmpeg.exe -y -loglevel 99 -i test.mp3 -strftime 1 %Y.ogg

I expected a file named 2020.ogg, however only got %Y.ogg. In another word, output filename is not processed by strftime(). I'm using powershell so there should be no relation with cmd's %% escaping.

Here's the output: https://pastebin.com/LUVh2kFA I'm using static builds from https://ffmpeg.zeranoe.com (Thanks Zeranoe!) I confirmed that the problem exists in v4.2.2 and git-20200515. Is there any chance to fix it or am I doing it wrong?

Thermoluminescent answered 18/5, 2020 at 11:53 Comment(0)
P
6

-strftime is not a general option and is only supported by certain muxers. A workaround is to use the segment muxer and to provide a -segment_time longer than the expected output duration:

ffmpeg -i input.mp3 -f segment -strftime 1 -segment_time 10:00:00 %Y.ogg
Presbyterial answered 18/5, 2020 at 16:58 Comment(4)
You saved my day! A little more to be mentioned, when using complex input source and with segment_format parameter, segment might not recognize the output file correctly, complaining ``. I fixed it by adding -map 0 before -f segment.Thermoluminescent
It's a little pity that with segment, bitrate is always "N/A". I've read the manual but found nothing. Are there workarounds about it?Thermoluminescent
@Thermoluminescent Use ffprobe after the file has been encoded: ffprobe -v error -show_entries stream=bit_rate -of csv=p=0 2020.oggPresbyterial
Actually I 'd prefer to monitor it (by reading ffmpeg's output with pipe). Seems no luck. Anyway thank you again!Thermoluminescent

© 2022 - 2025 — McMap. All rights reserved.