ffmpeg: Invalid segment filename template 'stream05d.ts'

Wildan Muhlis picture Wildan Muhlis · Apr 20, 2013 · Viewed 7.5k times · Source

I have tried to use http live streaming with ffmpeg windows build (http://ffmpeg.zeranoe.com/builds/)

Here's the command

ffmpeg.exe -v 9 -loglevel 99 -re -i tes.avi -an ^
-c:v libx264 -b:v 128k -preset medium ^
-flags -global_header -map 0 -f segment -segment_time 4 ^
-segment_list test.m3u8 -segment_format mpegts stream%^05d.ts

but an error message raised,

[segment @ 045f5840] Codec for stream 0 does not use global headers but container format requires global headers
[segment @ 045f5840] Selected stream id:0 type:video
[mpegts @ 062f2540] Invalid segment filename template 'stream05d.ts'
[AVIOContext @ 04a90e00] Statistics: 0 seeks, 0 writeouts
Output #0, segment, to 'stream05d.ts':
  Metadata:
    encoder         : Lavf55.2.100
    Stream #0:0, 0, 1/90000: Video: h264, yuv420p, 720x400 [SAR 1:1 DAR 9:5], 10
01/24000, q=-1--1, 128 kb/s, 90k tbn, 23.98 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> libx264)
Could not write header for output file #0 (incorrect codec parameters ?): Invali
d argument
[AVIOContext @ 0215a3e0] Statistics: 3028576 bytes read, 88 seeks

What's this error message mean and how to solve it?

Answer

Zombo picture Zombo · Apr 20, 2013
stream%05d.ts

With Windows, %0 is the name of the script, in your case tes.bat. Perhaps you need to escape the % like this

stream%%05d.ts

Ignore percent sign in batch file