Commit Graph

21416 Commits

Author SHA1 Message Date
Michael Niedermayer 38381400fc avformat/gdv: Check fps
Fixes: Division by 0
Fixes: ffmpeg_zero_division.bin

Found-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-03-14 16:24:35 +01:00
Jun Li c2a221c5ae avformat/rtpdec.h remove unused variable
Looks like the variable 'cur_timestamp' is not used anywhere.
So remove this variable.

Signed-off-by: Jun Li <junli1026@gmail.com>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-03-13 12:54:30 +01:00
Mark Reid 283ce69a10 avformat/mxfenc: allow user comments for opatom muxer
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-03-13 12:39:51 +01:00
Carl Eugen Hoyos 715186456c lavf/matroskaenc: Allow dvdsub remuxing from some containers.
Fixes ticket #7783.
2019-03-10 20:45:45 +01:00
Michael Niedermayer f94b4f1611 avformat/mpegts: Simplify score compare
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-03-09 15:31:44 +01:00
Andriy Gelman 0a84ba2608 avformat/mpegts: reduce buffering during initialization
Reduces buffering latency with low bitrate streams, where
8192 bytes can mean several seconds.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-03-09 15:27:07 +01:00
Matthew McKenna f95aee2b72 Add the Canon XF-HEVC UL to the picture essence container UL list 2019-03-08 14:14:15 +01:00
joepadmiraal 056a2ac168 avformat/dashenc: Added #EXT-X-PROGRAM-DATE-TIME to HLS playlists 2019-03-06 10:58:57 +05:30
Marton Balint 57580e2ab6 avformat/utils: fix indentation
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-03-01 22:31:00 +01:00
Marton Balint d4ae28e494 avformat/utils: be even more strict about stream specifiers
After this change we always parse the full specifier even if we know the result
in the middle of the parsing. Sligtly slower, but this is needed to
consistently reject incorrect specifiers in both matching and non-matching
cases.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-03-01 22:31:00 +01:00
Marton Balint 24e0e149ad avformat/utils: be more strict about stream specifiers
This reworks the code to be more strict about accepting stream specifiers. From
now on we strictly enforce the syntax in the documentation up until the
decisive part of the stream specifier. Therefore matching stream specifiers
always need to be correct, non matching specifiers only need to be correct
until the decisive part.

Also recursion is changed to a simple loop.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-03-01 22:31:00 +01:00
Marton Balint 837f2c9798 avformat/mpegtsenc: write format_identifier HEVC for HEVC streams
This improves compatibility with some consumer (LG WebOS) TVs which apparently
search a HEVC descriptor (which our mpegts muxer can't generate) or a format
identifier.

Since the HEVC format identifier is not registered (but used in the wild), it is
not written if strict_std_compliance is higher than normal.

This fixes the issue in ticket #7744.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-03-01 22:30:13 +01:00
Marton Balint fe36dcbff2 avformat/mpegtsenc: factorize writing registration_descriptor
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-03-01 22:30:13 +01:00
Justin Ruggles 97f47fd601 mov: Fix start_time for streams with empty edits in the middle
Empty edits can occur at any position within the edit list except for at
the end. Empty edits in the middle should not impact the reported stream
start_time or the video PTS adjustment, so only include empty edits at
the start of the list in empty_edits_sum_duration.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2019-02-26 14:48:27 -05:00
Justin Ruggles 69fcc093c1 http: Do not try to make a new request when seeking past the end of the file
This avoids making invalid HTTP Range requests for a byte range past the
known end of the file during a seek. Those requests generally return a HTTP
response of 416 Range Not Satisfiable, which causes an error response.

Reference: https://tools.ietf.org/html/rfc7233

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2019-02-26 14:48:27 -05:00
Karthick J 2e67f751b5 avformat/dashenc: Added comments
Added comments regarding usage of certain movflags in streaming mode.
2019-02-25 11:40:54 +05:30
Karthick J ca5ec4cbbc avformat/dashenc: Added option to repeatedly publish master playlist
The master playlist can be published at a specified interval with this option
2019-02-25 11:40:47 +05:30
Steve Lhomme a2c7702ccf avformat:matroskadec: use a define to mark the EBML length is unknown
Unifying the way the EBML unknown length is signaled, rather than using two
incompatible values. UINT64_MAX cannot be read as a valid EBML length with the
current code.

Co-authored-by: Steve Lhomme <robux4@ycbcr.xyz>
Co-authored-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-24 20:31:07 +01:00
Tristan Matthews 00f54c15f4 rtpenc_chain: forward strict_std_compliance flags to rtp muxer
fixes: https://trac.ffmpeg.org/ticket/6713
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-23 22:48:35 +01:00
Marton Balint 5adc4a98b3 avformat/mpegtsenc: add support for service and provider names with utf8 encoding
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-02-21 21:29:06 +01:00
Adam Sampson bfa33f548d lavf/jacosubdec: compute subtitle duration correctly
When a JACOsub subtitle has two timestamps, they represent its start and
end times (http://unicorn.us.com/jacosub/jscripts.html#l_times); the
duration is the difference between the two, not the sum of the two.

The subtitle end times in the FATE test for this were wrong as a result;
fix them too. (This test is based on JACOsub's demo.txt, and the end
time computed for the last line using @ now matches what the comments
there say it should be.)

Also tested in practice using MPV, a LaserDisc, and some authentic 1993
JACOsub files.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-20 21:15:07 +01:00
James Almer 1811b7d1f5 Merge commit '90b15f60bf4919deaed66d868e18107eba371da7'
* commit '90b15f60bf4919deaed66d868e18107eba371da7':
  srt: Set srto_sender flag to sender srt socket

Merged-by: James Almer <jamrial@gmail.com>
2019-02-20 15:50:06 -03:00
Xiaofeng Wang 821791caa0 lavf/mpeg: fix indent
Signed-off-by: Xiaofeng Wang <xiaofeng.wang@bqvision.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-18 23:08:38 +01:00
Steve Lhomme 9326117bf6 avformat/matroskadec: Check parents remaining length
This was found through the Hacker One program on VLC but is not a security issue in libavformat
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-17 10:29:42 +01:00
Michael Niedermayer b687b549aa avformat/webmdashenc: Check id in adaption_sets
Fixes: out of array access

Found-by: Wenxiang Qian
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-17 10:29:42 +01:00
Wenxiang Qian 85f91ed760 avformat/http: Fix Out-of-Bounds access in process_line()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-17 10:29:42 +01:00
Wenxiang Qian a142ffdcae avformat/ftp: Fix Out-of-Bounds Access and Information Leak in ftp.c:393
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-17 10:29:42 +01:00
Michael Niedermayer d1afa7284c avformat/matroskadec: Do not leak queued packets on sync errors
Fixes: memleak
Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-5649187601121280

Reported-by: Chris Cunningham <chcunningham@google.com>
Tested-by: Chris Cunningham <chcunningham@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-17 09:12:06 +01:00
Michael Niedermayer b0d8b7cb8e avformat/mov: Do not use reference stream in mov_read_sidx() if there is no reference stream
Fixes: NULL pointer dereference
Fixes: clusterfuzz-testcase-minimized-audio_decoder_fuzzer-5634316373721088

Reported-by: Chris Cunningham <chcunningham@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-14 21:55:43 +01:00
Marton Balint dbfd042983 avformat/utils: parse some stream specifiers recursively
This removes lots of code duplication and also allows more complex specifiers,
for example you can use p:204:aⓂ️language:eng to select the English language
audio stream from program 204.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-02-13 23:21:53 +01:00
Marton Balint b35843e391 avformat/mpegts: also convert strings without a specified encoding to UTF-8
The default codepage (ISO6937) should be used in this case.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-02-13 22:01:39 +01:00
Marton Balint dd6dd49f1d avformat/mpegts: fix charset of type 0x11
ISO-10646 alone means UCS-4 for iconv, the specs refers to the Basic
Multilingual Plane (BMP), therefore we need UCS-2. VLC also using that.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-02-13 22:01:39 +01:00
Sven Dueking 90b15f60bf srt: Set srto_sender flag to sender srt socket
SRT API Documentation:
This flag is superfluous if both parties are at least version 1.3.0
(this shall be enforced by setting this value to SRTO_MINVERSION if
you expect that it be true) and therefore support HSv5 handshake,
where the SRT extended handshake is done with the overall handshake
process.

This flag is however obligatory if at least one party may be using
SRT below version 1.3.0 and does not support HSv5.
2019-02-12 11:59:29 +01:00
Charles Liu aa25198f1b avformat/mov: fix hang while seek on a kind of fragmented mp4
Binary searching would hang if the fragment items do NOT have timestamp for the
specified stream.

For example, a fmp4 consists of separated 'moof' boxes for each track, and
separated 'sidx' for each segment, but no 'mfra' box.  Then every fragment item
only have the timestamp for one of its tracks.

Example:
ffmpeg -f lavfi -i testsrc -f lavfi -i sine -movflags dash+frag_keyframe+skip_trailer+separate_moof -t 1 out.mp4
ffmpeg -ss 0.5 -i out.mp4 -f null none

Also fixes the hang in ticket #7572, but not the reason for having
AV_NOPTS_VALUE timestamps there.

Signed-off-by: Charles Liu <liuchh83@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-02-11 22:01:06 +01:00
James Almer 00fd38f184 avformat/mov: don't rescale mastering display values from the SmDm atom
Simplifies code.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-02-11 16:58:27 -03:00
Carl Eugen Hoyos 6de396c216 lavf/img2: Move "loop" into common options.
While the image2pipe demuxer ignores the option - confusing users -
the autodetecting demuxers that are favoured over image2 act on it.
2019-02-10 18:56:46 +01:00
Carl Eugen Hoyos 826cc58deb lavf/img2dec: Split img2 and img2pipe options. 2019-02-10 17:56:01 +01:00
Steven Liu 9ec1f7634a avformat/hlsenc: fix fmp4_init_filename file name with %v problem
when set option fmp4_init_filename to init_%v.mp4
before patch:
the init file will be init_%v_0.mp4, init_%v_1.mp4
after patch:
the init file will be init_0.mp4, init_1.mp4

Reported-By: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-02-10 14:45:43 +08:00
Jan Ekström a03885b745 lavf/mpegts: add reading of ARIB data coding descriptor
This enables us to read the data coding type utilized for
a specific private data stream, of which we currently are
interested in ARIB caption streams.

The component tag limitations are according to ARIB TR-B14,
and the component IDs are defined in ARIB STD-B10.
2019-02-10 03:30:56 +02:00
Carl Eugen Hoyos 5c515b5f7d lavf/mpegts: Convert service_name and service_provider to utf-8.
Fixes ticket #6320.
2019-02-09 23:49:51 +01:00
chcunningham 1c15449ca9 avformat/mov: validate chunk_count vs stsc_data
Bad content may contain stsc boxes with a first_chunk index that
exceeds stco.entries (chunk_count). This ammends the existing check to
include cases where chunk_count == 0. It also patches up the case
when stsc refers to unknown chunks, but stts has no samples (so we
can simply ignore stsc).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-08 12:00:59 +01:00
chcunningham 3ea87e5d9e avformat/mov.c: require tfhd to begin parsing trun
Detecting missing tfhd avoids re-using tfhd track info from the previous
moof. For files with multiple tracks, this may make a mess of the
avindex and fragindex, which can later trigger av_assert0 in
mov_read_trun().

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-08 12:00:59 +01:00
Nikolas Bowe 2b8458fcc5 avformat/movenc: Add more error checking when writing sample entries.
Fixes a problem where a sample entry which cannot be written correctly appears to succeed, but produces an invalid file.
For example, this command:
ffmpeg -f lavfi -i sine=frequency=1000:duration=5 -codec:a ac3 -movflags +empty_moov -frag_duration 5000000 /tmp/foo.mp4
produced a file with the ac-3 sample entry, but no AC3SpecificBox (dac3) child, which is invalid according to ETSI TS 102 366.

Reviewed-by: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-07 00:29:01 +01:00
Paweł Wegner 835ab35ef0 libavformat/dashdec: disable seeking only for live streams.
Signed-off-by: Paweł Wegner <pawel.wegner95@gmail.com>
2019-02-06 13:01:34 +01:00
Marton Balint 4b46d1ee46 avformat/async: fix assertion condition when draining buffer
Fixes some random assertion failures with

ffprobe -show_packets async:samples/ffmpeg-bugs/trac/ticket6132/Samsung_HDR_-_Chasing_the_Light.ts > /dev/null

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-02-04 21:43:30 +01:00
Marton Balint 56c58b99d0 avformat/mpegts: cache PID discard values
discard_pid can be quite expensive, so let's cache it and recalculate it on
every packet start.

ffmpeg -y -i samples/MPEG-VOB/sdtv/RAI.ts -c copy -map 0✌️0 -map 0🅰️0 -f mpegts /dev/null

Before:
   1685 decicycles in handle_packet,  523483 runs,    805 skips

After:
    883 decicycles in handle_packet,  523505 runs,    783 skips

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-02-04 21:43:30 +01:00
Michael Niedermayer 497c9b0cce avformat/rtsp: Check number of streams in sdp_parse_line()
Fixes: OOM

Found-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-31 17:33:50 +01:00
Steven Liu 1e03d60054 avformat/hlsenc: add var_stream_map LANGUAGE field string parameter
use a:0,agroup:aud_low,default:Yes,language:CHN a:1,agroup:aud_low,language:ENG
        a:2,agroup:aud_high,default:YesYes,language:CHN a:3,agroup:aud_high,language:ENG
        v:0,agroup:aud_low v:1,agroup:aud_high
        create master m3u8 list.

result:
EXTM3U
EXT-X-VERSION:3
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_low",NAME="audio_0",DEFAULT=YES,LANGUAGE="CHN",URI="out_0.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_low",NAME="audio_1",DEFAULT=NO,LANGUAGE="ENG",URI="out_1.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_high",NAME="audio_2",DEFAULT=YES,LANGUAGE="CHN",URI="out_2.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_high",NAME="audio_3",DEFAULT=NO,LANGUAGE="ENG",URI="out_3.m3u8"
EXT-X-STREAM-INF:BANDWIDTH=1170400,RESOLUTION=640x480,CODECS="avc1.64001e,mp4a.40.2",AUDIO="group_aud_low"
out_4.m3u8
EXT-X-STREAM-INF:BANDWIDTH=3440800,RESOLUTION=640x480,CODECS="avc1.64001e,mp4a.40.2",AUDIO="group_aud_high"
out_5.m3u8

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-01-31 16:17:11 +08:00
Steven Liu 6a25bb5aa4 avformat/hlsenc: add var_stream_map DEFAULT field status parameter
use a:0,agroup:aud_low,default:Yes a:1,agroup:aud_low,
    a:2,agroup:aud_high,default:Yes a:3, agroup:aud_high,
    v:0,agroup:aud_low v:1,agroup:aud_high
    create master m3u8 list.

result:
EXTM3U
EXT-X-VERSION:3
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_low",NAME="audio_0",DEFAULT=YES,URI="out_0.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_low",NAME="audio_1",DEFAULT=NO,URI="out_1.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_high",NAME="audio_2",DEFAULT=YES,URI="out_2.m3u8"
EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="group_aud_high",NAME="audio_3",DEFAULT=NO,URI="out_3.m3u8"
EXT-X-STREAM-INF:BANDWIDTH=1170400,RESOLUTION=640x480,CODECS="avc1.64001e,mp4a.40.2",AUDIO="group_aud_low"
out_4.m3u8
EXT-X-STREAM-INF:BANDWIDTH=3440800,RESOLUTION=640x480,CODECS="avc1.64001e,mp4a.40.2",AUDIO="group_aud_high"
out_5.m3u8

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-01-31 16:17:02 +08:00
Steven Liu 62e8644bca avformat/hlsenc: make the EXT-X-MEDIA NAME field by stream id.
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2019-01-31 16:16:53 +08:00