2

For an app I'm developing, I need avconv to stream from a link for a specified length of time. I've tried using -timelimit to no avail. What am I doing wrong? Is there a better way to do this? Why doesn't -timelimit work?

See, for example, the call below, which runs until terminated with ctrl-c.

stack@ThinkPad:~/app_dev$ avconv -timelimit 30 -i http://br-mp3-bayern2sued-m.akacast.akamaistream.net/7/731/256282/v1/gnl.akacast.akamaistream.net/br_mp3_bayern2sued_m stack_test.mp3

Which generates the following output.

avconv version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
  built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
[mp3 @ 0x765100] Header missing
[mp3 @ 0x75f020] max_analyze_duration reached
[mp3 @ 0x75f020] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, mp3, from 'http://br-mp3-bayern2sued-m.akacast.akamaistream.net/7/731/256282/v1/gnl.akacast.akamaistream.net/br_mp3_bayern2sued_m':
  Duration: N/A, start: 0.000000, bitrate: 128 kb/s
    Stream #0.0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Output #0, mp3, to 'stack_test.mp3':
  Metadata:
    TSSE            : Lavf54.20.4
    Stream #0.0: Audio: libmp3lame, 44100 Hz, stereo, s16p
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 -> libmp3lame)
Press ctrl-c to stop encoding
[mp3 @ 0x765100] Header missing
Error while decoding stream #0:0
[mp3 @ 0x7639e0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: -2255 >= -2255
llogan
  • 121,796
  • 28
  • 232
  • 243

1 Answers1

2

-t and -timelimit are different. More importantly, you need to use -t as an output option, not as an input option. Updating your example, the following should work (tested on ffmpeg).

ffmpeg -i http://br-mp3-bayern2sued-m.akacast.akamaistream.net/7/731/256282/v1/gnl.akacast.akamaistream.net/br_mp3_bayern2sued_m  -t 30 stack_test.mp3