[FFmpeg-trac] #8413(undetermined:new): Demuxing embedded H.264 frames from mjpeg stream from Logitech webcam

FFmpeg trac at avcodec.org
Wed Dec 4 12:34:55 EET 2019


#8413: Demuxing embedded H.264 frames from mjpeg stream from Logitech webcam
-------------------------------------+-------------------------------------
             Reporter:  cmeister2    |                     Type:
                                     |  enhancement
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 The Logitech C920 webcam has the capability of generating H.264 video.
 Unfortunately in newer revisions, it achieves this by embedding those
 frames in an MJPEG stream as APP0 data. This can be seen by doing the
 following, as per [https://stackoverflow.com/questions/55439184/getting-
 unable-to-decode-app-fields-while-playing-usb-webcam-stream-through-ff
 here]:

 {{{
 # create a small mp4, copying mjpeg stream off the cam for one second
 $ ffmpeg -f v4l2 -input_format mjpeg -i /dev/video0 -c:v copy -t 1
 test.mp4

 # extract the unaltered jpeg files inside the stream
 $ ffmpeg -i test.mp4 -vcodec copy %03d.jpg

 # view any of the jpeg files for APP attachments
 $ exiv2 -pS 001.jpg

 STRUCTURE OF JPEG FILE: 001.jpg
  address | marker     | length  | data
        2 | 0xd8 SOI   |       0
        4 | 0xdb DQT   |     197
      203 | 0xc0 SOF0  |      17
      222 | 0xc4 DHT   |      31
      255 | 0xc4 DHT   |     181
      438 | 0xc4 DHT   |      31
      471 | 0xc4 DHT   |     181
      654 | 0xfe COM   |      10
      666 | 0xe0 APP0  |      16 | ...............................
      684 | 0xdd DRI   |       4
      690 | 0xda SOS   |      12
 }}}

 My plan is to write a demuxer to demux this mjpeg stream into both mjpeg
 data and H.264 data, so I can simply copy H.264 data into the output. This
 would be similar to the gstreamer plugin
 [https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-
 bad/html/gst-plugins-bad-plugins-uvch264mjpgdemux.html uvch264mjpgdemux],
 except in ffmpeg.

 I posted about this on the ffmpeg-devel IRC and someone suggested I raise
 a ticket for this, so here's the ticket!

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8413>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list