On Fri, May 11, 2018 at 3:05 PM, Stephan Holljes <klaxa1...@googlemail.com> wrote: > On Fri, May 11, 2018 at 2:49 PM, Moritz Barsnick <barsn...@gmx.net> wrote: >> On Thu, May 10, 2018 at 17:41:25 +0200, Stephan Holljes wrote: >>> +ffserver: segment.o publisher.o lavfhttpd.o ffserver.c >>> + cc -g -Wall $(LAV_FLAGS) -lpthread -o ffserver segment.o publisher.o >>> lavfhttpd.o ffserver.c >> ^ $(CC) $(CFLAGS) to be more generic and allow overriding. >> >> The LDFLAGS "$(LAV_FLAGS) -lpthread" need to be at the end of the >> command for my compile/link chains to work. *shrug* >> >>> +clean: >>> + rm *.o ffserver >> >> Make this "rm -f" to silence warnings about non-existant files. > > Ok > >> >>> diff --git a/ffserver.c b/ffserver.c >> >> It may be me, but the whole thing doesn't work for me. >> >> With any MP4 file, I get: >> >> [AVIOContext @ 0xa3c3b40] { >> "free": 16, >> "reserved": 0, >> "wait": 0, >> "writable": 0, >> "busy": 0, >> "buffer_full": 0, >> "current_read": -1, >> "newest_write": 0, >> "oldest_write": -1 >> } >> [mov,mp4,m4a,3gp,3g2,mj2 @ 0xa394580] Finding video stream. >> [matroska @ 0xb4319700] Tag mp4a incompatible with output codec id '86018' >> ([255][0][0][0]) >> [matroska @ 0xb4319700] Error occured while writing header: Invalid data >> found when processing input >> Segmentation fault >> >> gdb, if it's of interest: >> Program received signal SIGSEGV, Segmentation fault. >> [Switching to Thread 0xb5717b90 (LWP 26045)] >> 0x08068d6d in compute_muxer_pkt_fields (s=0xb4c19240, st=0xfffffffe, >> pkt=0xffffffff) at src/libavformat/mux.c:640 >> 640 st->internal->priv_pts->val = pkt->dts; >> >> (ffmpeg of the same version as the libs has no issue processing the >> same file to matroska.) >> >> Using an MKV as input, it launches as such: >> >> [AVIOContext @ 0xb441e5c0] { >> "free": 16, >> "reserved": 0, >> "wait": 0, >> "writable": 0, >> "busy": 0, >> "buffer_full": 0, >> "current_read": -1, >> "newest_write": 0, >> "oldest_write": -1 >> } >> [matroska,webm @ 0xa166580] Finding video stream. >> [AVIOContext @ 0xb441e5c0] Shutting down http server. >> >> "Shutting down"??? And I can't connect and play. >> >> It may just be me though. Hope this helps anyway. >> >> Moritz >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > Hmm that *is* a problem. Maybe I should have used more than one file > for testing. I just tested another file and it also only worked > properly on second try. This time there was a condition I could not > reproduce the last few days: >>[matroska @ 0x55eb77169040] Application provided invalid, non monotonically >>increasing dts to muxer in stream 0: 18894 >= 18894 > I already mentioned that I'm not too sure about way I handle > timestamps. (Currently each segment has a separate dynamic array > filled with dts and pts as int64_t taken from the demuxer during > reading.) > > I also tested an mp4 file and I can reproduce the error message. I'm > guessing it's "only" a metadata thing, but I know ffmpeg can mux this > without problems, so I'll investigate how to do that. > > Thanks for the time, I will assemble more files for testing!
I figured out how to prevent the fatal error during muxing by looking at doc/examples/remuxing.c. In the process I came to the conclusion that the incorrect timestamps written to a client most likely are a race condition, since after testing with a single thread and after tightening locking this does no longer occur. The first hint for this was also given by compiling with address sanitation. However, there is still something wrong with the timestamps. Remuxing from an mp4 file to in-memory matroska segments yields: > [matroska @ 0x61b00001ea80] Starting new cluster due to timestamp many times in the output. The stream produced can also not properly be played, mpv outputs: > Invalid audio PTS: 0.023220 -> 1.024000 This does not happen with matroska files that are read. I will send an updated version including the fixes from the other emails. Maybe someone can point me to some resources about timestamps and how to deal with them? Like I mentioned a few times, I'm really not sure how to do this properly. In the meantime I'll read more doc/example code and probably ffmpeg.c as well. Thanks! Stephan _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel