[FFmpeg-cvslog] avformat/mpegtsenc: Changed Video PES packet length to 0.
Graham Booker
git at videolan.org
Tue Apr 22 16:37:16 CEST 2014
ffmpeg | branch: master | Graham Booker <gbooker at tamu.edu> | Fri Apr 11 23:26:46 2014 -0500| [60fcc19b9068614f25cf64dff5e4aa0e8dbff6a5] | committer: Michael Niedermayer
avformat/mpegtsenc: Changed Video PES packet length to 0.
The rational for this is another issue that plex has exposed. When it is
conducting a transcode of video to HLS for streaming, my father noticed
artifacts when played on his GoogleTV (NSZ-GT1). He sent me a test file
and I reproduced it on my device of the same model. It is important to
note that the artifacts were not present when streaming to VLC or QuickTime
Player. I copied the command-line that plex used, and conducted all of the
following tests using FFmpeg git.
Transcode to HLS: artifacts on playback
Transcode to TS: playback is fine
Cat HLS segments into a single TS: playback is fine
Segment single TS file to segments: artifacts on playback
Segment single TS file to segments using Apple's HLS segmenter: playback is
fine
At this point I carefully examined the differences between Apple's HLS
segmenter output and FFmpeg's. Among the considerable differences, I
noticed that the video PES packets always had a 0 length. So I continued:
Transcode to HLS using FFmpeg with 0 length PES packets: playback is fine.
Segment single TS to segments with 0 length PES packets: playback is fine.
All failures mentioned are only on the GTV since it is the only player on
which I could reproduce artifacts. I only tested the GTV, VLC, and
QuickTime Player though, so my test case is limited. I do not know if
other players exhibit this issue.
Since it was useful last time, I have uploaded the test file as
hls_pes_packet_length.m4v along with its associated txt file which contains
the transcode command-line that was used.
Reviewed-by: Kieran Kunhya <kierank at obe.tv>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=60fcc19b9068614f25cf64dff5e4aa0e8dbff6a5
---
libavformat/mpegtsenc.c | 3 +++
tests/ref/lavf/ts | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 8d80e07..9cc17cc 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1066,6 +1066,9 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
}
if (len > 0xffff)
len = 0;
+ if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+ len = 0;
+ }
*q++ = len >> 8;
*q++ = len;
val = 0x80;
diff --git a/tests/ref/lavf/ts b/tests/ref/lavf/ts
index d457dfa..1381f09 100644
--- a/tests/ref/lavf/ts
+++ b/tests/ref/lavf/ts
@@ -1,3 +1,3 @@
-e0738e00907d371ffbdee5caeab4277d *./tests/data/lavf/lavf.ts
+cca6bca512605bbde20b7aa5cccf4850 *./tests/data/lavf/lavf.ts
407020 ./tests/data/lavf/lavf.ts
./tests/data/lavf/lavf.ts CRC=0x71287e25
More information about the ffmpeg-cvslog
mailing list