Closed
Bug 1347448
Opened 9 years ago
Closed 9 years ago
H.264 stream format issues in FF
Categories
(Core :: Audio/Video: Recording, defect)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: i, Unassigned)
Details
(Whiteboard: [needinfo jya 2017/3/17])
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36
Steps to reproduce:
Hi, we’ve been playing with video recording recently and found some strange issues with H.264 stream format from FF (in attachment)
This is pack that contains two MKV records of H.264 from both Chrome and Firefox
Chrome: chrome.mkv
Firefox: firefox.mkv
to view settings, it's possible to call ffprobe from FFMPEG package (test.sh)
./ffprobe -print_format json -show_streams ./chrome.mkv > chrome.mkv.ffprobe
./ffprobe -print_format json -show_streams ./firefox.mkv > firefox.mkv.ffprobe
result is JSON with info about H.264 tracks chrome.mkv.ffprobe and firefox.mkv.ffprobe
that H264 tracks have following difference:
CH: "codec_time_base": "33/2000"
FF: "codec_time_base": "0/2"
CH: "field_order": "progressive",
FF:
CH: "is_avc": "false"
FF: "is_avc": "true"
CH: "nal_length_size": "0"
FF: "nal_length_size": "4"
CH: "r_frame_rate": "30/1"
FF: "r_frame_rate": "2000/2"
CH: "avg_frame_rate": "1000/33"
FF: "avg_frame_rate": "0/0"
when we convert it to MP4 file format via (conv_chrome.sh)
./ffmpeg -y -i ./chrome.mkv -an -vprofile baseline -c:v copy -movflags +faststart -strict -2 chfome.mp4
Everything is fine
but with Firefox (conv_firefox.sh):
./ffmpeg -y -i ./firefox.mkv -an -vprofile baseline -c:v copy -movflags +faststart -strict -2 firefox.mp4
there is a problem with MP4 and video stream playback (freezes) when using different players:
FFmpeg version 3.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)
configuration: --disable-debug --enable-libmp3lame --enable-libopus --enable-libspeex --enable-gpl --enable-libx264 --disable-shared --pkg-config-flags=--static --enable-static --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --prefix=/home/ishmakov/ffmpeg/ffmpeg- --extra-libs=-ldl
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.100 / 57. 64.100
libavformat 57. 56.100 / 57. 56.100
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
[h264 @ 0x3f81940] illegal aspect ratio
[h264 @ 0x3f81940] Invalid nal size 1119886988
[h264 @ 0x3f81940] missing picture in access unit with size 12035
[h264 @ 0x3f81940] non-existing PPS 0 referenced
Last message repeated 46 times
Input #0, matroska,webm, from './firefox.mkv':
Metadata:
encoder : Zingaya RTP MKV
Duration: 00:00:05.76, start: 0.000000, bitrate: 435 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Stream #0:1(eng): Video: h264 (Constrained Baseline), yuv420p, 640x480, SAR 1:1 DAR 4:3, 1k tbr, 1k tbn, 2k tbc (default)
Stream #0:2(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Output #0, mp4, to 'firefox.mp4':
Metadata:
encoder : Lavf57.56.100
Stream #0:0(eng): Video: h264 (Constrained Baseline) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 1k tbr, 16k tbn, 1k tbc (default)
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
[NULL @ 0x3f81940] non-existing PPS 0 referenced
Last message repeated 58 times
[NULL @ 0x3f81940] illegal aspect ratio
[NULL @ 0x3f81940] Invalid nal size 1119886915
[NULL @ 0x3f81940] missing picture in access unit with size 6548
[NULL @ 0x3f81940] non-existing PPS 1 referenced
Last message repeated 56 times
[mp4 @ 0x40f3280] Starting second pass: moving the moov atom to the beginning of the file
frame= 0 fps=0.0 q=-1.0 Lsize= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
| Reporter | ||
Comment 1•9 years ago
|
||
Sorry. File to large to attach
You can download it here
http://demos02.voximplant.com/videodata/H264_CH&FF.zip
Updated•9 years ago
|
Component: General → Audio/Video: Playback
Comment 2•9 years ago
|
||
this isn't playback...
I find it rather suspicious that firefox would generate a mkv, we do not support it, only webm and only with either vp8 or vp9 codec...
How did you produce those files?
Component: Audio/Video: Playback → Audio/Video: Recording
Flags: needinfo?(i)
Comment 3•9 years ago
|
||
(In reply to Jean-Yves Avenard [:jya] from comment #2)
> this isn't playback...
>
> I find it rather suspicious that firefox would generate a mkv, we do not
> support it, only webm and only with either vp8 or vp9 codec...
>
> How did you produce those files?
Hi. We develop our WebRTC Media server with video recording (VP8/H.264).
Third-party services can obtain video stream from WebRTC via RTP, remove packetization and push direct ISO video stream to MOV or MP4 containers. We do the same with VP8, VP9 and H.264 too.
We obtain direct ISO H.264 stream with 00000001-AUD, 00000001-SPS, 00000001-PPS, 00000001-IDR and etc...
and pack it into MKV ISO container. Nothing extraordinary.
Next, we use FFMPEG to convert MKV(VP8) to WebM and MOV(H.264) to MP4 that most common for users playback in Windows/Linux/MacOS.
So. Our service obtain H.264 stream from Chrome WebRTC and pack to MKV and FFMPEG understand this stream and repack to MP4 (-v:c copy) and all is good playback.
But if we obtain H.264 from Firefox WebRTC this stream can't be played direct .h264, mkv and FFMPEG don't understand this H.264 stream.
We are trying to ask you about the difference in H.264 in CH and FF, why FFMPEG don't understand stream from FF?
I note the difference in ffprobe settings and note that SPS and PPS id in Chrome are always zero, but SPS and PPS id in FF are increment 1 2 3 4 5 6...
I note that FFMPEG start understands H.264 FF stream if we extend FFMPEG with x264 and using -v:c libx264, but it's not good to convert stream on the server (need memory, cpu)...
I ask you as an expert in H.264 encoder settings in Firefox.
Is it possible to change H.264 setting in FF to obtain H.264 RTP stream that supported with FFMPEG without x264 and allows direct H.264 copy... OR any ideas about to transform H.264 FF stream for FFMPEG support like H.264 in Chrome?
Comment 4•9 years ago
|
||
It means that H.264 in FF and CH are different and FFMPEG not understand FF and support Chrome H.264 stream.
Updated•9 years ago
|
Flags: needinfo?(rjesup)
Comment 5•9 years ago
|
||
So. It looks that problem is in pps_id
CH: SPS_0 PPS_0 IDR ... SPS_0 PPS_0 IDR ... SPS_0 PPS_0 IDR ...
FF: SPS_0 PPS_0 IDR ... SPS_1 PPS_1 IDR ... SPS_2 PPS_2 IDR ...
But one SPS can have N SPS...
SPS_0:
PPS_0 - ok
SPS_1:
PPS_0 - not exists (ffmpeg and players ask where and stop decoding SPS_1)
PPS_1 -
SPS_2:
PPS_0 - not exists (ffmpeg and players ask where and stop decoding SPS_2)
PPS_1 - not exists
PPS_2
Comment 6•9 years ago
|
||
Well, I suspect this is a bug in FFMPEG; I think this is a totally valid sequence for H.264, and the default generated by OpenH264, which has tons of conformance tests. Note that if there was a resolution change, the SPS/PPS would need to change.
See H.264 spec 7.4.1.2.1 Order of sequence and picture parameter set RBSPs and their activation
You can read the whole thing; one example:
" At most one picture parameter set RBSP is considered active at any given moment during the operation of the decoding process, and the activation of any particular picture parameter set RBSP results in the deactivation of the previously-active picture parameter set RBSP (if any). "
and they become active when a NAL references them: "When a picture parameter set RBSP (with a particular value of pic_parameter_set_id) is not active and it is referred to by a coded slice NAL unit or coded slice data partition A NAL unit (using that value of pic_parameter_set_id), it is activated" etc.
so likely what you have is SPS_0 PPS_0 IDR(0) ... SPS_1 PPS_2 IDR(1) etc
Perhaps some assumption in the conversion to the container format is causing the problem?
Flags: needinfo?(rjesup)
Updated•9 years ago
|
Flags: needinfo?(jyavenard)
Whiteboard: [needinfo jya 2017/3/17]
Comment 7•9 years ago
|
||
I'm not sure there's anything we can action here...
Our H264 decoder only works with the first SPS found
Flags: needinfo?(jyavenard)
Comment 8•9 years ago
|
||
This has gotten quite old and it's not clear that we're at fault. Please re-open if you acquire new evidence that this is the case.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INCOMPLETE
Comment 9•12 days ago
|
||
Clearing the needinfo request since this bug has been closed as INCOMPLETE for 8 years, 11 months and 25 days.
For more information, please visit BugBot documentation.
Flags: needinfo?(i)
You need to log in
before you can comment on or make changes to this bug.
Description
•