[FFmpeg-trac] #4231(ffmpeg:new): cannot produce .y4m files for use in the Chrome browser

FFmpeg trac at avcodec.org
Wed Feb 17 11:54:08 CET 2016


#4231: cannot produce .y4m files for use in the Chrome browser
------------------------------------+----------------------------------
             Reporter:  nha         |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  ffmpeg
              Version:  git-master  |               Resolution:
             Keywords:  y4m         |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+----------------------------------

Old description:

> == Summary of the bug ==
> cannot produce .y4m files for use in the Chrome browser.
>

> I am trying to convert .mp4 files to .y4m files for use with Chrome as
> described at https://code.google.com/p/chromium/issues/detail?id=318797.
>
> == How to reproduce ==
>
> I have a set of .y4m files that are working for my use case, taken from
> http://media.xiph.org/video/derf/y4m/?C=N;O=A. I made the following tests
> tpecifically with the file
> http://media.xiph.org/video/derf/y4m/mobile_qcif_7.5fps.y4m.
>
> I also have a .mp4 file (http://techslides.com/demos/sample-
> videos/small.mp4 file from http://techslides.com/sample-webm-ogg-and-mp4
> -video-files-for-html5). I convert small.mp4 to small.y4m using :
>
> {{{ ffmpeg -y -i small.mp4 does_not_play_in_chrome.y4m }}}
>
> I also tried (same end result) :
>
>  * {{{ ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe
> -y does_not_play_in_chrome.y4m }}}
>

>  * {{{ ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe
> -pix_fmt yuv420p -y does_not_play_in_chrome.y4m }}}
>
> To test it, start chrome with the flags {{{ --use-file-for-fake-video-
> capture=does_not_play_in_chrome.y4m --use-fake-device-for-media-stream
> }}}, and trigger a media access (ex. by accessing
> https://apprtc.appspot.com/).
>

> == Desired result ==
>
> I would like the resulting file to be accepted by Chrome.
> Note that does_not_play_in_chrome.y4m plays fine on VLC.
>

> So
>
> {{{
> $ head -c 100 does_not_play_in_chrome.y4m
> YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420mpeg2 XYSCSS=420MPEG2
> FRAME
> 9999999999999999999999999999999999
> }}}
>
> should probably be :
>
> {{{
> $ head -c 100 does_play_in_chrome.y4m
> YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420 XYSCSS=420MPEG2
> FRAME
> 9999999999999999999999999999999999
> }}}
>
> == Additionnal information ==
>
>  * Editing manually the header of the resulting file from :
>    "YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420mpeg2 XYSCSS=420MPEG2 FRAME"...
>    to "YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420 XYSCSS=420MPEG2 FRAME"...
>    or to "YUV4MPEG2 W560 H320 F15:2 Ip A0:0 XYSCSS=420MPEG2 FRAME"
>    make it play correctly with Chrome. I see no mention of the "mpeg2"
> parameter there : http://wiki.multimedia.cx/index.php?title=YUV4MPEG2 .
> It seems to come from
> https://www.ffmpeg.org/doxygen/2.5/yuv4mpegenc_8c_source.html#l00069
>  * I am on an Ubuntu 13.10 with ffmpeg compiled from the latest git
> master branch
>
> {{{
> $ ffmpeg version N-68884-g3ebd76a Copyright (c) 2000-2015 the FFmpeg
> developers
>   built on Jan  6 2015 11:03:21 with gcc 4.8 (Ubuntu/Linaro
> 4.8.1-10ubuntu9)
>   configuration:
>   libavutil      54. 16.100 / 54. 16.100
>   libavcodec     56. 19.100 / 56. 19.100
>   libavformat    56. 18.100 / 56. 18.100
>   libavdevice    56.  3.100 / 56.  3.100
>   libavfilter     5.  6.100 /  5.  6.100
>   libswscale      3.  1.101 /  3.  1.101
>   libswresample   1.  1.100 /  1.  1.100
> }}}
>
>  * Note : I originally asked this question on
> http://stackoverflow.com/questions/27783703/ffmpeg-determine-correct-
> codec-to-use
>
> == Full command output ==
>
> {{{
> $ ffmpeg  -v 9 -loglevel 99 -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f
> yuv4mpegpipe -y does_not_play_in_chrome.y4m
> ffmpeg version N-68884-g3ebd76a Copyright (c) 2000-2015 the FFmpeg
> developers
>   built on Jan  6 2015 11:03:21 with gcc 4.8 (Ubuntu/Linaro
> 4.8.1-10ubuntu9)
>   configuration:
>   libavutil      54. 16.100 / 54. 16.100
>   libavcodec     56. 19.100 / 56. 19.100
>   libavformat    56. 18.100 / 56. 18.100
>   libavdevice    56.  3.100 / 56.  3.100
>   libavfilter     5.  6.100 /  5.  6.100
>   libswscale      3.  1.101 /  3.  1.101
>   libswresample   1.  1.100 /  1.  1.100
> Splitting the commandline.
> Reading option '-v' ... matched as option 'v' (set logging level) with
> argument '9'.
> Reading option '-loglevel' ... matched as option 'loglevel' (set logging
> level) with argument '99'.
> Reading option '-i' ... matched as input file with argument 'small.mp4'.
> Reading option '-vf' ... matched as option 'vf' (set video filters) with
> argument 'fps=7.5'.
> Reading option '-an' ... matched as option 'an' (disable audio) with
> argument '1'.
> Reading option '-c:v' ... matched as option 'c' (codec name) with
> argument 'rawvideo'.
> Reading option '-f' ... matched as option 'f' (force format) with
> argument 'yuv4mpegpipe'.
> Reading option '-y' ... matched as option 'y' (overwrite output files)
> with argument '1'.
> Reading option 'does_not_play_in_chrome.y4m' ... matched as output file.
> Finished splitting the commandline.
> Parsing a group of options: global .
> Applying option v (set logging level) with argument 9.
> Applying option y (overwrite output files) with argument 1.
> Successfully parsed a group of options.
> Parsing a group of options: input file small.mp4.
> Successfully parsed a group of options.
> Opening an input file: small.mp4.
> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] Format mov,mp4,m4a,3gp,3g2,mj2
> probed with size=2048 and score=100
> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] ISO: File Type Major Brand: mp42
> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] overread end of atom 'colr' by 1
> bytes
> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] Before avformat_find_stream_info()
> pos: 383523 bytes read:36359 seeks:1
> [aac @ 0x30f92c0] skip whole frame, skip left: 0
> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] All info found
> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] After avformat_find_stream_info()
> pos: 28292 bytes read:69127 seeks:2 frames:5
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'small.mp4':
>   Metadata:
>     major_brand     : mp42
>     minor_version   : 0
>     compatible_brands: mp42isomavc1
>     creation_time   : 2010-03-20 21:29:11
>     encoder         : HandBrake 0.9.4 2009112300
>   Duration: 00:00:05.57, start: 0.000000, bitrate: 551 kb/s
>     Stream #0:0(und), 4, 1/90000: Video: h264 (Constrained Baseline)
> (avc1 / 0x31637661), yuv420p(tv, bt709, left), 560x320, 1/60, 465 kb/s,
> 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
>     Metadata:
>       creation_time   : 2010-03-20 21:29:11
>       encoder         : JVT/AVC Coding
>     Stream #0:1(eng), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D),
> 48000 Hz, mono, fltp, 83 kb/s (default)
>     Metadata:
>       creation_time   : 2010-03-20 21:29:11
> Successfully opened the file.
> Parsing a group of options: output file does_not_play_in_chrome.y4m.
> Applying option vf (set video filters) with argument fps=7.5.
> Applying option an (disable audio) with argument 1.
> Applying option c:v (codec name) with argument rawvideo.
> Applying option f (force format) with argument yuv4mpegpipe.
> Successfully parsed a group of options.
> Opening an output file: does_not_play_in_chrome.y4m.
> Successfully opened the file.
> detected 2 logical cores
> [Parsed_fps_0 @ 0x30f30a0] Setting 'fps' to value '7.5'
> [Parsed_fps_0 @ 0x30f30a0] fps=15/2
> [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'video_size' to value
> '560x320'
> [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'pix_fmt' to value
> '0'
> [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'time_base' to value
> '1/90000'
> [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'pixel_aspect' to
> value '0/1'
> [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'sws_param' to value
> 'flags=2'
> [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'frame_rate' to value
> '30/1'
> [graph 0 input from stream 0:0 @ 0x30e8920] w:560 h:320 pixfmt:yuv420p
> tb:1/90000 fr:30/1 sar:0/1 sws_param:flags=2
> [AVFilterGraph @ 0x30e8760] query_formats: 3 queried, 2 merged, 0 already
> done, 0 delayed
> Output #0, yuv4mpegpipe, to 'does_not_play_in_chrome.y4m':
>   Metadata:
>     major_brand     : mp42
>     minor_version   : 0
>     compatible_brands: mp42isomavc1
>     encoder         : Lavf56.18.100
>     Stream #0:0(und), 0, 2/15: Video: rawvideo (I420 / 0x30323449),
> yuv420p(left), 560x320, 2/15, q=2-31, 200 kb/s, 7.50 fps, 7.50 tbn, 7.50
> tbc (default)
>     Metadata:
>       creation_time   : 2010-03-20 21:29:11
>       encoder         : Lavc56.19.100 rawvideo
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
> Press [q] to stop, [?] for help
> [Parsed_fps_0 @ 0x30f30a0] Dropping 1 frame(s).
> [yuv4mpegpipe @ 0x30fac80] Encoder did not produce proper pts, making
> some up.
> [Parsed_fps_0 @ 0x30f30a0] Dropping 1 frame(s).
>     Last message repeated 122 times
> [output stream 0:0 @ 0x30dea80] EOF on sink link output stream
> 0:0:default.
> No more output streams to write to, finishing.
> frame=   42 fps=0.0 q=0.0 Lsize=   11025kB time=00:00:05.60
> bitrate=16128.4kbits/s
> video:4kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 279907.750000%
> Input file #0 (small.mp4):
>   Input stream #0:0 (video): 166 packets read (322069 bytes); 166 frames
> decoded;
>   Input stream #0:1 (audio): 1 packets read (247 bytes);
>   Total: 167 packets (322316 bytes) demuxed
> Output file #0 (does_not_play_in_chrome.y4m):
>   Output stream #0:0 (video): 0 frames encoded; 42 packets muxed (4032
> bytes);
>   Total: 42 packets (4032 bytes) muxed
> 168 frames successfully decoded, 0 decoding errors
> [Parsed_fps_0 @ 0x30f30a0] 166 frames in, 42 frames out; 124 frames
> dropped, 0 frames duplicated.
> [AVIOContext @ 0x30fb6c0] Statistics: 0 seeks, 378 writeouts
> [AVIOContext @ 0x30f2b20] Statistics: 419822 bytes read, 2 seeks
> }}}

New description:

 == Summary of the bug ==
 cannot produce .y4m files for use in the Chrome browser.


 I am trying to convert .mp4 files to .y4m files for use with Chrome as
 described at https://code.google.com/p/chromium/issues/detail?id=318797.

 == How to reproduce ==

 I have a set of .y4m files that are working for my use case, taken from
 http://media.xiph.org/video/derf/y4m/?C=N;O=A. I made the following tests
 tpecifically with the file
 http://media.xiph.org/video/derf/y4m/mobile_qcif_7.5fps.y4m.

 I also have a .mp4 file (http://techslides.com/demos/sample-
 videos/small.mp4 file from http://techslides.com/sample-webm-ogg-and-mp4
 -video-files-for-html5). I convert small.mp4 to small.y4m using :

 {{{ ffmpeg -y -i small.mp4 does_not_play_in_chrome.y4m }}}

 I also tried (same end result) :

  * {{{ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe
 -y does_not_play_in_chrome.y4m }}}


  * {{{ ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe
 -pix_fmt yuv420p -y does_not_play_in_chrome.y4m }}}

 To test it, start chrome with the flags {{{--use-file-for-fake-video-
 capture=does_not_play_in_chrome.y4m --use-fake-device-for-media-stream
 }}}, and trigger a media access (ex. by accessing
 https://apprtc.appspot.com/).


 == Desired result ==

 I would like the resulting file to be accepted by Chrome.
 Note that does_not_play_in_chrome.y4m plays fine on VLC.


 So

 {{{
 $ head -c 100 does_not_play_in_chrome.y4m
 YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420mpeg2 XYSCSS=420MPEG2
 FRAME
 9999999999999999999999999999999999
 }}}

 should probably be :

 {{{
 $ head -c 100 does_play_in_chrome.y4m
 YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420 XYSCSS=420MPEG2
 FRAME
 9999999999999999999999999999999999
 }}}

 == Additionnal information ==

  * Editing manually the header of the resulting file from :
    "YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420mpeg2 XYSCSS=420MPEG2 FRAME"...
    to "YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420 XYSCSS=420MPEG2 FRAME"...
    or to "YUV4MPEG2 W560 H320 F15:2 Ip A0:0 XYSCSS=420MPEG2 FRAME"
    make it play correctly with Chrome. I see no mention of the "mpeg2"
 parameter there : http://wiki.multimedia.cx/index.php?title=YUV4MPEG2 . It
 seems to come from
 https://www.ffmpeg.org/doxygen/2.5/yuv4mpegenc_8c_source.html#l00069
  * I am on an Ubuntu 13.10 with ffmpeg compiled from the latest git master
 branch

 {{{
 $ ffmpeg version N-68884-g3ebd76a Copyright (c) 2000-2015 the FFmpeg
 developers
   built on Jan  6 2015 11:03:21 with gcc 4.8 (Ubuntu/Linaro
 4.8.1-10ubuntu9)
   configuration:
   libavutil      54. 16.100 / 54. 16.100
   libavcodec     56. 19.100 / 56. 19.100
   libavformat    56. 18.100 / 56. 18.100
   libavdevice    56.  3.100 / 56.  3.100
   libavfilter     5.  6.100 /  5.  6.100
   libswscale      3.  1.101 /  3.  1.101
   libswresample   1.  1.100 /  1.  1.100
 }}}

  * Note : I originally asked this question on
 http://stackoverflow.com/questions/27783703/ffmpeg-determine-correct-
 codec-to-use

 == Full command output ==

 {{{
 $ ffmpeg  -v 9 -loglevel 99 -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f
 yuv4mpegpipe -y does_not_play_in_chrome.y4m
 ffmpeg version N-68884-g3ebd76a Copyright (c) 2000-2015 the FFmpeg
 developers
   built on Jan  6 2015 11:03:21 with gcc 4.8 (Ubuntu/Linaro
 4.8.1-10ubuntu9)
   configuration:
   libavutil      54. 16.100 / 54. 16.100
   libavcodec     56. 19.100 / 56. 19.100
   libavformat    56. 18.100 / 56. 18.100
   libavdevice    56.  3.100 / 56.  3.100
   libavfilter     5.  6.100 /  5.  6.100
   libswscale      3.  1.101 /  3.  1.101
   libswresample   1.  1.100 /  1.  1.100
 Splitting the commandline.
 Reading option '-v' ... matched as option 'v' (set logging level) with
 argument '9'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument '99'.
 Reading option '-i' ... matched as input file with argument 'small.mp4'.
 Reading option '-vf' ... matched as option 'vf' (set video filters) with
 argument 'fps=7.5'.
 Reading option '-an' ... matched as option 'an' (disable audio) with
 argument '1'.
 Reading option '-c:v' ... matched as option 'c' (codec name) with argument
 'rawvideo'.
 Reading option '-f' ... matched as option 'f' (force format) with argument
 'yuv4mpegpipe'.
 Reading option '-y' ... matched as option 'y' (overwrite output files)
 with argument '1'.
 Reading option 'does_not_play_in_chrome.y4m' ... matched as output file.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option v (set logging level) with argument 9.
 Applying option y (overwrite output files) with argument 1.
 Successfully parsed a group of options.
 Parsing a group of options: input file small.mp4.
 Successfully parsed a group of options.
 Opening an input file: small.mp4.
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] Format mov,mp4,m4a,3gp,3g2,mj2
 probed with size=2048 and score=100
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] ISO: File Type Major Brand: mp42
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] overread end of atom 'colr' by 1
 bytes
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] Before avformat_find_stream_info()
 pos: 383523 bytes read:36359 seeks:1
 [aac @ 0x30f92c0] skip whole frame, skip left: 0
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] All info found
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x30f31c0] After avformat_find_stream_info()
 pos: 28292 bytes read:69127 seeks:2 frames:5
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'small.mp4':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: mp42isomavc1
     creation_time   : 2010-03-20 21:29:11
     encoder         : HandBrake 0.9.4 2009112300
   Duration: 00:00:05.57, start: 0.000000, bitrate: 551 kb/s
     Stream #0:0(und), 4, 1/90000: Video: h264 (Constrained Baseline) (avc1
 / 0x31637661), yuv420p(tv, bt709, left), 560x320, 1/60, 465 kb/s, 30 fps,
 30 tbr, 90k tbn, 60 tbc (default)
     Metadata:
       creation_time   : 2010-03-20 21:29:11
       encoder         : JVT/AVC Coding
     Stream #0:1(eng), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D),
 48000 Hz, mono, fltp, 83 kb/s (default)
     Metadata:
       creation_time   : 2010-03-20 21:29:11
 Successfully opened the file.
 Parsing a group of options: output file does_not_play_in_chrome.y4m.
 Applying option vf (set video filters) with argument fps=7.5.
 Applying option an (disable audio) with argument 1.
 Applying option c:v (codec name) with argument rawvideo.
 Applying option f (force format) with argument yuv4mpegpipe.
 Successfully parsed a group of options.
 Opening an output file: does_not_play_in_chrome.y4m.
 Successfully opened the file.
 detected 2 logical cores
 [Parsed_fps_0 @ 0x30f30a0] Setting 'fps' to value '7.5'
 [Parsed_fps_0 @ 0x30f30a0] fps=15/2
 [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'video_size' to value
 '560x320'
 [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'pix_fmt' to value '0'
 [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'time_base' to value
 '1/90000'
 [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'pixel_aspect' to
 value '0/1'
 [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'sws_param' to value
 'flags=2'
 [graph 0 input from stream 0:0 @ 0x30e8920] Setting 'frame_rate' to value
 '30/1'
 [graph 0 input from stream 0:0 @ 0x30e8920] w:560 h:320 pixfmt:yuv420p
 tb:1/90000 fr:30/1 sar:0/1 sws_param:flags=2
 [AVFilterGraph @ 0x30e8760] query_formats: 3 queried, 2 merged, 0 already
 done, 0 delayed
 Output #0, yuv4mpegpipe, to 'does_not_play_in_chrome.y4m':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: mp42isomavc1
     encoder         : Lavf56.18.100
     Stream #0:0(und), 0, 2/15: Video: rawvideo (I420 / 0x30323449),
 yuv420p(left), 560x320, 2/15, q=2-31, 200 kb/s, 7.50 fps, 7.50 tbn, 7.50
 tbc (default)
     Metadata:
       creation_time   : 2010-03-20 21:29:11
       encoder         : Lavc56.19.100 rawvideo
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
 Press [q] to stop, [?] for help
 [Parsed_fps_0 @ 0x30f30a0] Dropping 1 frame(s).
 [yuv4mpegpipe @ 0x30fac80] Encoder did not produce proper pts, making some
 up.
 [Parsed_fps_0 @ 0x30f30a0] Dropping 1 frame(s).
     Last message repeated 122 times
 [output stream 0:0 @ 0x30dea80] EOF on sink link output stream
 0:0:default.
 No more output streams to write to, finishing.
 frame=   42 fps=0.0 q=0.0 Lsize=   11025kB time=00:00:05.60
 bitrate=16128.4kbits/s
 video:4kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 279907.750000%
 Input file #0 (small.mp4):
   Input stream #0:0 (video): 166 packets read (322069 bytes); 166 frames
 decoded;
   Input stream #0:1 (audio): 1 packets read (247 bytes);
   Total: 167 packets (322316 bytes) demuxed
 Output file #0 (does_not_play_in_chrome.y4m):
   Output stream #0:0 (video): 0 frames encoded; 42 packets muxed (4032
 bytes);
   Total: 42 packets (4032 bytes) muxed
 168 frames successfully decoded, 0 decoding errors
 [Parsed_fps_0 @ 0x30f30a0] 166 frames in, 42 frames out; 124 frames
 dropped, 0 frames duplicated.
 [AVIOContext @ 0x30fb6c0] Statistics: 0 seeks, 378 writeouts
 [AVIOContext @ 0x30f2b20] Statistics: 419822 bytes read, 2 seeks
 }}}

--

Comment (by richardpl):

 Is this still reproducible?

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4231#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list