14 Commits

Author SHA1 Message Date
Sergey Dobrodey
16dde98b2c videostreamer.c: dont call avformat_free_context
avformat_close_input  frees context and all its contents and set it to NULL
https://www.ffmpeg.org/doxygen/3.3/group__lavf__decoding.html#gae804b99aec044690162b8b9b110236a4
2019-07-18 18:13:13 +03:00
Will Storey
d4640f77fb Use simpler method for retrieving error message 2018-07-23 17:31:45 -07:00
Will Storey
3673c3ce0b Provide error reason if opening input fails 2018-07-23 17:31:35 -07:00
Will Storey
c2aa2d30b5 Fix dts if we receive packets with NOPTS after having PTS
This is similar to the situation where we receive packets with lower dts
than we previously output, except in this case we have no pts at all.

An alternative may be to skip such packets all together, but let's try
fixing them first.

This is related to #5.
2018-01-13 11:58:31 -08:00
Will Storey
93d839ecef Manually set dts if it's the same as the last we output
In #1 we changed to manually set it if it is less than the last we
output. Apparently there are streams where it can be equal as well.

If we don't do this, then we see errors such as "Application provided
invalid, non monotonically increasing dts to muxer"
2018-01-11 21:44:54 -08:00
Will Storey
42c330c730 Log error when writing frame fails
Also add some log output for when the number of clients change, and when
we open the input. Looking at debugging for issue #2.
2017-04-08 16:21:08 -07:00
Will Storey
734ccb6d6b Support input with non-monotonic dts
This fixes issue #1.

It appears there are inputs where the dts fluctuates. This is apparently
inputs that are not well formed. However, I discovered that ffmpeg
itself allows for this. If it detects this happening, it updates the
pts/dts of the packet. To do this, it tracks the last output dts. This
ensures the output dts is monotonic even if the input is not.

I use essentially the same approach as in ffmpeg.
2017-03-14 12:00:07 -07:00
Will Storey
0b32184301 Fix indentation in a function. 2017-03-14 11:10:56 -07:00
Will Storey
215b19773a Ensure we always write to output stream 0
If an input has multiple streams, then the packet's stream index for the
video stream we are reading may not match our output's stream index.
This can lead to errors such as:

[mp4 @ 0x5631c5836000] Invalid packet stream index: 1

Update the packet's stream index, prior to writing it, to match what it
is in our output.

I also update a comment (around line 294) to clarify that while we're
skipping a packet, it's not because it's not video.
2017-03-14 11:07:53 -07:00
Will Storey
aba249aa62 Fix warnings about unset timestamps 2017-01-03 13:50:14 -08:00
Will Storey
4440856472 Clean up HTML and some comments 2017-01-01 22:56:16 -08:00
Will Storey
37325f57b0 Open input/output separately, and read/write separately
This is a refactor of the library API so that we will be able to have
multiple outputs.
2017-01-01 14:58:29 -08:00
Will Storey
fd0ddf62da Fix remux example to take correct main() params
Also add comments explaining the program and the videostreamer lib.
2016-12-31 13:16:15 -08:00
Will Storey
7f16d84882 Initial import
This works for streaming mp4 from rtsp. But only to the first client as
it is unable to recognize discrete frames correctly. It needs further
work.
2016-12-31 13:12:45 -08:00