Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > New and alternative video codecs
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th December 2016, 06:33   #1  |  Link
WorBry
Registered User
 
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
Motion-JPEG bt470bg ?

I've just been looking at some raw HD video clips from several DSLR cameras (Nikon, Panasonic) that were recorded in Motion-JPEG format.

Examining the clips with FFProbe I was surprised to see the Color Primaries being reported as bt470bg (i.e. smpte170m=Rec.601), which seems a bit odd given that this is HD material. Example:

Code:
ffprobe version N-82664-g801b5c1 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-d
va2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fo
tconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable
libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgm
 --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
le-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-l
bopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-l
bsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwola
e --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvp
 --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enabl
-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 41.101 / 55. 41.101
  libavcodec     57. 66.108 / 57. 66.108
  libavformat    57. 58.101 / 57. 58.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 67.100 /  6. 67.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'X:/22485969.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537331972
    compatible_brands: qt  pana
    creation_time   : 2010-06-10T16:50:54.000000Z
  Duration: 00:00:12.00, start: 0.000000, bitrate: 52100 kb/s
    Stream #0:0(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj420p(pc, bt470bg/un
nown/unknown), 1920x1080, 51586 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2010-06-10T16:50:54.000000Z
      encoder         : Photo - JPEG
    Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 16000 Hz, 2 channel
, s16, 512 kb/s (default)
    Metadata:
      creation_time   : 2010-06-10T16:50:54.000000Z
[FORMAT]
filename=X:/22485969.mov
nb_streams=2
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=12.000000
size=78150730
bit_rate=52100486
probe_score=100
TAG:major_brand=qt
TAG:minor_version=537331972
TAG:compatible_brands=qt  pana
TAG:creation_time=2010-06-10T16:50:54.000000Z
[/FORMAT]
To see if it made any difference, I tried transcoding another HD-AVC.mp4 DSLR clip (with full range luma) to MJPEG, setting the encode colorspace to BT709:

Code:
ffmpeg -i X:\EOSM3FS.mp4 -vcodec mjpeg -q:v 2 -colorspace bt709 X:\EOSM3FS_MJPEG.mov
The encode completed without any errors/warnings:

Code:
ffmpeg version N-82664-g801b5c1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dx
va2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fon
tconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-
libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
 --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enab
le-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-li
bopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-li
bsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolam
e --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
 --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable
-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 41.101 / 55. 41.101
  libavcodec     57. 66.108 / 57. 66.108
  libavformat    57. 58.101 / 57. 58.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 67.100 /  6. 67.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'X:\EOSM3FS.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42avc1CAEP
    copyright       :
    copyright-eng   :
    creation_time   : 2015-04-19T13:07:02.000000Z
  Duration: 00:00:46.88, start: 0.000000, bitrate: 22232 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709
), 1920x1080, 22088 kb/s, 25 fps, 25 tbr, 25k tbn, 50k tbc (default)
    Metadata:
      creation_time   : 2015-04-19T13:07:02.000000Z
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p, 127 kb/s (default)
    Metadata:
      creation_time   : 2015-04-19T13:07:02.000000Z
Output #0, mov, to 'X:\EOSM3FS_MJPEG.mov':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42avc1CAEP
    copyright       :
    copyright-eng   :
    encoder         : Lavf57.58.101
    Stream #0:0(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj420p(pc, bt709/unkno
wn/unknown), 1920x1080, q=2-31, 200 kb/s, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2015-04-19T13:07:02.000000Z
      encoder         : Lavc57.66.108 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p, 128 kb/s (default)
    Metadata:
      creation_time   : 2015-04-19T13:07:02.000000Z
      encoder         : Lavc57.66.108 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=   47 fps=0.0 q=2.0 size=    6400kB time=00:00:02.34 bitrate=22341.4kbits/...
....frame= 1170 fps=121 q=2.0 Lsize=  199255kB time=00:00:46.86 bitrate=34826.6kbits
/s speed=4.84x
video:198483kB audio:745kB subtitle:0kB other streams:0kB global headers:0kB mux
ing overhead: 0.013574%
[aac @ 00000000004e7020] Qavg: 464.457
But when I examined the MJPEG encode with FFProbe the Color Primary was again reported as being BT470bg:

Code:
ffprobe version N-82664-g801b5c1 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dx
va2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fon
tconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-
libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
 --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enab
le-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-li
bopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-li
bsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolam
e --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
 --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable
-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 41.101 / 55. 41.101
  libavcodec     57. 66.108 / 57. 66.108
  libavformat    57. 58.101 / 57. 58.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 67.100 /  6. 67.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'X:/EOSM3FS_MJPEG.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf57.58.101
  Duration: 00:00:46.89, start: 0.000000, bitrate: 34810 kb/s
    Stream #0:0(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj420p(pc, bt470bg/unk
nown/unknown, progressive), 1920x1080, 34743 kb/s, 25 fps, 25 tbr, 12800 tbn, 12
800 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.66.108 mjpeg
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p, 130 kb/s (default)
    Metadata:
      handler_name    : DataHandler
[FORMAT]
filename=X:/EOSM3FS_MJPEG.mov
nb_streams=2
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=46.891000
size=204037614
bit_rate=34810537
probe_score=100
TAG:major_brand=qt
TAG:minor_version=512
TAG:compatible_brands=qt
TAG:encoder=Lavf57.58.101
[/FORMAT]
If that really is the case, I'm wondering what implications this might have for importing M-JPEG footage into NLE's that normally apply Rec709 transforms to HD material, and more particularly (being a current area of interest) Linux-based NLE's that use ffmpeg (or MLT) for import/export and rely on FFProbe to obtain the clip properties - including KDenLive and a recent incarnation of Cinelerra (GG 5.1) ?

Are they going to treat these M-JPEG clips as being Rec.601 or Rec.709 when it comes to applying conversion co-efficients ?

Any insight would be appreciated. Thanks.
__________________
Nostalgia's not what it used to be

Last edited by WorBry; 28th December 2016 at 15:59.
WorBry is offline   Reply With Quote
Old 22nd September 2021, 16:02   #2  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 541
What? ALL JPEG IS BT.601 matrix with FULL range. /facepalm

Yes, that is bad since prinaries are BT.709, so a mismatch happens.

"encode colorspace to BT709:"

You did not set encode colorspace. This is just a tag.

"Rec709 transforms to HD material"

This does not use BT.709 transfer! It uses sRGB.

They will treat them as being BT.601 matrix, sRGB transfer, BT.709 primaries.

Last edited by Balling; 22nd September 2021 at 16:06.
Balling is offline   Reply With Quote
Old 29th September 2021, 20:08   #3  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,770
Ah, Motion JPEG. The Next Big Thing of the late 90's.

I was stunned to find out the current After Effects can't even open old MJPEG .mov files anymore.

I believe there was some 709 overlap so there are probably some 709 MJPEG files out there, and I'd be surprised if any modern cameras are actually recording in 601. But who knows. These would be very low-cost devices these days.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:57.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.