Opened 11 years ago
Last modified 11 years ago
#2918 new defect
Transmuxing Facebook MP4s creates bad mpeg-ts stream
Reported by: | Neal McConnell | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | unspecified | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
OS: CentOS 6.3 64-bit
Build: N-55797-g535d9a9
Obtained from: http://ffmpeg.gusari.org/static/64bit/
Summary of the bug:
Attempting to transmux an MP4 file downloaded from Facebook to mpeg-ts or HLS stream results in an an invalid stream. By invalid, I mean an mpeg-ts file or pipe stream is produced that FFmpeg itself cannot use. From my brief analysis, the problem looks to be redundant PPS, one for each key-frame, a few packets prior to the one that belongs.
How to reproduce:
The command I really want to use: ffmpeg -i transmuxme.mp4 -sn -codec copy -bsf:v h264_mp4toannexb -f mpegts pipe:1 | ffmpeg -f mpegts -i pipe:0 -codec copy -map 0 -f ssegment -segment_format mpegts -initial_offset 10 segmentName_%04d.ts Commands that I used to make things simpler: Go from MP4 to MPEG-TS file ffmpeg -i transmuxme.mp4 -sn -codec copy -bsf:v h264_mp4toannexb -f mpegts mp4tots.ts Read-in the TS file just created to segment(receive errors reading the file): ffmpeg -i mp4tots.ts -map 0 -sn -codec copy -bsf:v h264_mp4toannexb -f ssegment -segment_format mpegts -initial_offset 10 segmentName_%04d.ts
The full console output are attached, as I used "-report". They are quite lengthy to put in-line here.
Attachments (6)
Change History (8)
by , 11 years ago
Attachment: | MP4_to_HLS_using_MPEGTS_pipe.log added |
---|
by , 11 years ago
Attachment: | MP4_to_MPEGTS.log added |
---|
Report from going from MP4 to MPEG-TS pipe (step 1)
by , 11 years ago
Attachment: | MPEGTS_to_HLS.log added |
---|
Report from going from MPEG-TS file to HLS (step 2)
by , 11 years ago
Attachment: | mp4tots.ts added |
---|
Resulting file from transmuxing MP4 to MPEG-TS file. Good for analysis.
follow-up: 2 comment:1 by , 11 years ago
Replying to nealzebub:
Attempting to transmux an MP4 file downloaded from Facebook to mpeg-ts or HLS stream results in an an invalid stream. By invalid, I mean an mpeg-ts file or pipe stream is produced that FFmpeg itself cannot use.
I tried to remux the mp4 file you attached, and the output stream plays fine here with ffplay and can be transcoded with ffmpeg. Could you explain (again) what is wrong with the output file?
$ ffmpeg -i transmuxme.mp4 -c copy -bsf h264_mp4toannexb out.ts ffmpeg version N-55912-gd814a83 Copyright (c) 2000-2013 the FFmpeg developers built on Aug 30 2013 19:39:36 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl --disable-indev=jack libavutil 52. 42.100 / 52. 42.100 libavcodec 55. 29.100 / 55. 29.100 libavformat 55. 15.100 / 55. 15.100 libavdevice 55. 3.100 / 55. 3.100 libavfilter 3. 82.102 / 3. 82.102 libswscale 2. 5.100 / 2. 5.100 libswresample 0. 17.103 / 0. 17.103 libpostproc 52. 3.100 / 52. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'transmuxme.mp4': Metadata: major_brand : FACE minor_version : 1337 compatible_brands: isomavc1FACE creation_time : 2013-08-30 14:15:11 Duration: 00:00:36.80, start: 0.000000, bitrate: 292 kb/s Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 400x224, 245 kb/s, 29.91 fps, 29.91 tbr, 29910 tbn, 59.82 tbc (default) Metadata: creation_time : 2013-08-30 14:15:11 handler_name : /tmp/10151818995537162_video.264 - Imported with GPAC 0.4.6-DEV-rev3544 Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 45 kb/s (default) Metadata: creation_time : 2013-08-30 14:15:11 handler_name : /tmp/10151818995537162_audio.aac - Imported with GPAC 0.4.6-DEV-rev3544 Output #0, mpegts, to 'out.ts': Metadata: major_brand : FACE minor_version : 1337 compatible_brands: isomavc1FACE encoder : Lavf55.15.100 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 400x224, q=2-31, 245 kb/s, 29.91 fps, 90k tbn, 29.91 tbc (default) Metadata: creation_time : 2013-08-30 14:15:11 handler_name : /tmp/10151818995537162_video.264 - Imported with GPAC 0.4.6-DEV-rev3544 Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, 45 kb/s (default) Metadata: creation_time : 2013-08-30 14:15:11 handler_name : /tmp/10151818995537162_audio.aac - Imported with GPAC 0.4.6-DEV-rev3544 Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help [adts @ 0x2e68be0] Encoder did not produce proper pts, making some up. frame= 1098 fps=0.0 q=-1.0 Lsize= 1564kB time=00:00:36.80 bitrate= 348.2kbits/s video:1098kB audio:205kB subtitle:0 global headers:0kB muxing overhead 20.054055%
comment:2 by , 11 years ago
Replying to cehoyos:
Replying to nealzebub:
Attempting to transmux an MP4 file downloaded from Facebook to mpeg-ts or HLS stream results in an an invalid stream. By invalid, I mean an mpeg-ts file or pipe stream is produced that FFmpeg itself cannot use.
I tried to remux the mp4 file you attached, and the output stream plays fine here with ffplay and can be transcoded with ffmpeg. Could you explain (again) what is wrong with the output file?
Now that you have that "out.ts", attempt to remux it to HLS(mpeg-ts) segments, like what I tried. Then you'll see the problem.
ffmpeg -i out.ts -map 0 -sn -codec copy -bsf:v h264_mp4toannexb -f ssegment -segment_format mpegts -initial_offset 10 segmentName_%04d.ts
by , 11 years ago
Attachment: | TS_packets_redundant_PPS_.PNG added |
---|
A screenshot of the TS analysis tool showing redundant PPS for frame 30. Not seen with any other transmux.
Report from attempting to go from MP4 to HLS, using MPEG-TS pipe