You are not logged in.
Mplayer currently doesn't seem to handle the growing files. They are usually used when you stream something from the web (e.g. youtube-dl). Now when mplayer reaches the offset which was the size at the open time it just quits with various errors. Here's a simple way to reproduce. Get/download a movie and do the following (let's name our movie b.mp4):
$ size=$((2*1024*1024))
$ head -c $size b.mp4 > a.mp4
Now start mplayer a.mp4. Tweak the size parameter to have around ~10 seconds of movie. Mplayer will quit when it reaches the 10th second. Now do this:
$ head -c $size b.mp4 > a.mp4
$ [start the movie in the background and wait until it begins to play]
$ tail -c +$((size+1)) b.mp4 >> a.mp4
Mplayer will still quit at the 10th second even though it could continue playing (VLC continues to play without a hitch).
Mplayer used to continue playing but it was because ffmpeg was buggy and stopped working after the following patch has been introduced: http://patches.libav.org/patch/14105/
I'm not sure how to fix this properly but this patch seems to fix this on my computer. There's a related bug to this and this patch seems to fix that too: http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1821
I've sent this patch upstream, but I got no response, so I thought I post it here in case anybody else wants to try it (or try to send it upstream again):
Index: stream/cache2.c
===================================================================
--- stream/cache2.c (revision 34788)
+++ stream/cache2.c (working copy)
@@ -579,6 +579,15 @@
return (cv->max_filepos-cv->read_filepos)/(cv->buffer_size / 100);
}
+off_t cache_maxpos(stream_t *s)
+{
+ cache_vars_t *cv;
+ if (!s || !s->cache_data)
+ return -1;
+ cv = s->cache_data;
+ return cv->max_filepos - 1;
+}
+
int cache_stream_seek_long(stream_t *stream,off_t pos){
cache_vars_t* s;
off_t newpos;
Index: stream/cache2.h
===================================================================
--- stream/cache2.h (revision 34788)
+++ stream/cache2.h (working copy)
@@ -24,5 +24,7 @@
void cache_uninit(stream_t *s);
int cache_do_control(stream_t *stream, int cmd, void *arg);
int cache_fill_status(stream_t *s);
+/// Return the offset of the last byte in the cache.
+off_t cache_maxpos(stream_t *s);
#endif /* MPLAYER_CACHE2_H */
Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c (revision 34788)
+++ libmpdemux/demux_lavf.c (working copy)
@@ -99,6 +99,8 @@
stream_t *stream = demuxer->stream;
int64_t current_pos;
mp_msg(MSGT_HEADER,MSGL_DBG2,"mp_seek(%p, %"PRId64", %d)\n", stream, pos, whence);
+ off_t maxpos = stream->end_pos = cache_maxpos(stream);
+ if (maxpos+1 > stream->end_pos) stream->end_pos = maxpos+1;
if(whence == SEEK_CUR)
pos +=stream_tell(stream);
else if(whence == SEEK_END && stream->end_pos > 0)
Offline
Thank you for this. I've been experiencing this problem and I find it very disruptive to my normal work-flow. For now, I've downgraded to mplayer version 34426-3, since I don't want to compile the whole of mplayer. Hopefully upstream can get this issue sorted out.
Offline