조회 수 714 추천 수 0 댓글 3
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

 

안녕하세요. 평소에 샤나인코더를 잘 사용하다가 특정 매개변수가 적용되지 않아 이유가 궁금해 글을 작성하게 되었습니다.

제가 인코딩하는 영상 중에는 비디오 색상 범위가 제한인 경우도 있고 전체인 경우도 있습니다.

그런데 h264_nvenc로 영상을 인코딩할 경우 비디오 색상 범위가 전부 제한으로 변경되어서 출력됩니다.

-bsf:v h264_metadata=video_full_range_flag=-1 변수를 넣어 입력 파일의 비디오 색상 범위를 출력 파일에도 적용되도록 했지만, 여전히 h264_nvenc로 인코딩 시 출력파일 색상 범위가 제한으로 나옵니다.

이게 황당한게 -bsf:v h264_metadata=video_full_range_flag=1을 넣어 출력 파일의 비디오 색상 범위를 전체로 고정시킬 경우 출력파일에는 전체로 나옵니다. 또한 스트림 복사 설정에 -bsf:v h264_metadata=video_full_range_flag=-1 변수 입력 시 출력파일이 정상적으로 입력파일의 비디오 색상 범위를 따라갑니다.

h264_nvenc 코덱은 -bsf:v h264_metadata=video_full_range_flag=-1 변수를 사용할 수 없나요? ffmpeg에 샤나인코더에서 사용하는 매개변수를 동일하게 맞출 경우 해당 변수가 작동되어 출력파일의 비디오 색상 범위가 전체로 나오는 것을 확인했습니다. 샤나인코더는 안돼요...

샤나인코더에서 사용한 매개변수 정보와 테스트에 활용한 영상 정보를 같이 첨부합니다.

 

인코딩 매개변수 정보

-f mp4 -c:v h264_nvenc -c:a copy -sn -cq 35 -profile:v high -level auto -preset p7 -tune:v hq -bsf:v h264_metadata=video_full_range_flag=-1

 

테스트 영상 정보

General
Complete name                            : D:\video\encoder\test.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 22.1 MiB
Duration                                 : 30 s 67 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 6 169 kb/s
Writing application                      : ShanaEncoder

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.2
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Format settings, GOP                     : M=3, N=120
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 30 s 67 ms
Source duration                          : 30 s 34 ms
Bit rate mode                            : Constant
Bit rate                                 : 6 033 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 60.000 FPS
Minimum frame rate                       : 58.824 FPS
Maximum frame rate                       : 62.500 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.048
Stream size                              : 21.6 MiB (98%)
Source stream size                       : 21.6 MiB (98%)
Color range                              : Full
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
mdhd_Duration                            : 30067
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 30 s 12 ms
Source duration                          : 30 s 59 ms
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 469 KiB (2%)
Source stream size                       : 470 KiB (2%)
Default                                  : Yes
Alternate group                          : 1

자세한 정보

General
Count                                    : 331
Count of stream of this kind             : 1
Kind of stream                           : General
Kind of stream                           : General
Stream identifier                        : 0
Count of video streams                   : 1
Count of audio streams                   : 1
Video_Format_List                        : AVC
Video_Format_WithHint_List               : AVC
Codecs Video                             : AVC
Audio_Format_List                        : AAC LC
Audio_Format_WithHint_List               : AAC LC
Audio codecs                             : AAC LC
Complete name                            : D:\video\encoder\test.mp4
Folder name                              : D:\video\encoder
File name extension                      : test.mp4
File name                                : test
File extension                           : mp4
Format                                   : MPEG-4
Format                                   : MPEG-4
Format/Extensions usually used           : braw mov mp4 m4v m4a m4b m4p m4r 3ga 3gpa 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma ismt f4a f4b f4v
Commercial name                          : MPEG-4
Format profile                           : Base Media
Internet media type                      : video/mp4
Codec ID                                 : isom
Codec ID                                 : isom (isom/iso2/avc1/mp41)
Codec ID/Url                             : http://www.apple.com/quicktime/download/standalone.html
CodecID_Compatible                       : isom/iso2/avc1/mp41
File size                                : 23183545
File size                                : 22.1 MiB
File size                                : 22 MiB
File size                                : 22 MiB
File size                                : 22.1 MiB
File size                                : 22.11 MiB
Duration                                 : 30067
Duration                                 : 30 s 67 ms
Duration                                 : 30 s 67 ms
Duration                                 : 30 s 67 ms
Duration                                 : 00:00:30.067
Duration                                 : 00:00:30:02
Duration                                 : 00:00:30.067 (00:00:30:02)
Overall bit rate mode                    : CBR
Overall bit rate mode                    : Constant
Overall bit rate                         : 6168502
Overall bit rate                         : 6 169 kb/s
Frame rate                               : 60.000
Frame rate                               : 60.000 FPS
Frame count                              : 1802
Stream size                              : 55074
Stream size                              : 53.8 KiB (0%)
Stream size                              : 54 KiB
Stream size                              : 54 KiB
Stream size                              : 53.8 KiB
Stream size                              : 53.78 KiB
Stream size                              : 53.8 KiB (0%)
Proportion of this stream                : 0.00238
HeaderSize                               : 40
DataSize                                 : 23129125
FooterSize                               : 54380
IsStreamable                             : No
File creation date                       : UTC 2022-06-30 08:49:09.843
File creation date (local)               : 2022-06-30 17:49:09.843
File last modification date              : UTC 2022-06-30 08:49:09.870
File last modification date (local)      : 2022-06-30 17:49:09.870
Writing application                      : ShanaEncoder
Writing application                      : ShanaEncoder

Video
Count                                    : 383
Count of stream of this kind             : 1
Kind of stream                           : Video
Kind of stream                           : Video
Stream identifier                        : 0
StreamOrder                              : 0
ID                                       : 1
ID                                       : 1
Format                                   : AVC
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format/Url                               : http://developers.videolan.org/x264.html
Commercial name                          : AVC
Format profile                           : High@L4.2
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4
Format settings, Reference frames        : 4 frames
Format settings, GOP                     : M=3, N=120
Internet media type                      : video/H264
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 30067
Duration                                 : 30 s 67 ms
Duration                                 : 30 s 67 ms
Duration                                 : 30 s 67 ms
Duration                                 : 00:00:30.067
Duration                                 : 00:00:30:02
Duration                                 : 00:00:30.067 (00:00:30:02)
Source duration                          : 30034
Source duration                          : 30 s 34 ms
Source duration                          : 30 s 34 ms
Source duration                          : 30 s 34 ms
Source duration                          : 00:00:30.034
Bit rate mode                            : CBR
Bit rate mode                            : Constant
Bit rate                                 : 6032723
Bit rate                                 : 6 033 kb/s
Width                                    : 1920
Width                                    : 1 920 pixels
Height                                   : 1080
Height                                   : 1 080 pixels
Stored_Height                            : 1088
Sampled_Width                            : 1920
Sampled_Height                           : 1080
Pixel aspect ratio                       : 1.000
Display aspect ratio                     : 1.778
Display aspect ratio                     : 16:9
Rotation                                 : 0.000
Frame rate mode                          : VFR
Frame rate mode                          : Variable
Frame rate                               : 60.000
Frame rate                               : 60.000 FPS
Minimum frame rate                       : 58.824
Minimum frame rate                       : 58.824 FPS
Maximum frame rate                       : 62.500
Maximum frame rate                       : 62.500 FPS
Frame count                              : 1802
Source frame count                       : 1802
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Chroma subsampling                       : 4:2:0
Bit depth                                : 8
Bit depth                                : 8 bits
Scan type                                : Progressive
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.048
Stream size                              : 22648101
Stream size                              : 21.6 MiB (98%)
Stream size                              : 22 MiB
Stream size                              : 22 MiB
Stream size                              : 21.6 MiB
Stream size                              : 21.60 MiB
Stream size                              : 21.6 MiB (98%)
Proportion of this stream                : 0.97690
Source stream size                       : 22648101
Source stream size                       : 21.6 MiB (98%)
Source stream size                       : 22 MiB
Source stream size                       : 22 MiB
Source stream size                       : 21.6 MiB
Source stream size                       : 21.60 MiB
Source stream size                       : 21.6 MiB (98%)
Source_StreamSize_Proportion             : 0.97690
Buffer size                              : 6000000
colour_description_present               : Yes
colour_description_present_Source        : Container / Stream
Color range                              : Full
colour_range_Source                      : Container / Stream
Color primaries                          : BT.709
colour_primaries_Source                  : Container / Stream
Transfer characteristics                 : BT.709
transfer_characteristics_Source          : Container / Stream
Matrix coefficients                      : BT.709
matrix_coefficients_Source               : Container / Stream
Source_Delay                             : -33
Source_Delay_Source                      : Container
mdhd_Duration                            : 30067
Codec configuration box                  : avcC

Audio
Count                                    : 280
Count of stream of this kind             : 1
Kind of stream                           : Audio
Kind of stream                           : Audio
Stream identifier                        : 0
StreamOrder                              : 1
ID                                       : 2
ID                                       : 2
Format                                   : AAC
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Commercial name                          : AAC
Format_AdditionalFeatures                : LC
Codec ID                                 : mp4a-40-2
Duration                                 : 30012
Duration                                 : 30 s 12 ms
Duration                                 : 30 s 12 ms
Duration                                 : 30 s 12 ms
Duration                                 : 00:00:30.012
Duration                                 : 00:00:29:44
Duration                                 : 00:00:30.012 (00:00:29:44)
Source duration                          : 30059
Source duration                          : 30 s 59 ms
Source duration                          : 30 s 59 ms
Source duration                          : 30 s 59 ms
Source duration                          : 00:00:30.059
Bit rate mode                            : CBR
Bit rate mode                            : Constant
Bit rate                                 : 128020
Bit rate                                 : 128 kb/s
Channel(s)                               : 2
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Channel positions                        : 2/0/0
Channel layout                           : L R
Samples per frame                        : 1024
Sampling rate                            : 48000
Sampling rate                            : 48.0 kHz
Samples count                            : 1440576
Frame rate                               : 46.875
Frame rate                               : 46.875 FPS (1024 SPF)
Frame count                              : 1407
Source frame count                       : 1409
Compression mode                         : Lossy
Compression mode                         : Lossy
Stream size                              : 480370
Stream size                              : 469 KiB (2%)
Stream size                              : 469 KiB
Stream size                              : 469 KiB
Stream size                              : 469 KiB
Stream size                              : 469.1 KiB
Stream size                              : 469 KiB (2%)
Proportion of this stream                : 0.02072
Source stream size                       : 481016
Source stream size                       : 470 KiB (2%)
Source stream size                       : 470 KiB
Source stream size                       : 470 KiB
Source stream size                       : 470 KiB
Source stream size                       : 469.7 KiB
Source stream size                       : 470 KiB (2%)
Source_StreamSize_Proportion             : 0.02075
Default                                  : Yes
Default                                  : Yes
Alternate group                          : 1
Alternate group                          : 1

MediaInfoLib - v21.09

Facebook Twitter Pinterest Kakao
  • ?
    JKyle 2022.07.07 14:29

    단순히 메타데이터만 그렇게 보이는 건지, 실제로 영상 color range가 그렇게 바뀌는 건지는 확인해 봐야 할 겁니다.

    영상 자체의 color range에 상관없이 메타데이터만 그렇게 바뀐다면 샤나인코더 ffmpeg 엔진의 소소한 버그겠고, 원본이 full인데 항상 limited로 바뀐다면 고쳐야 할 버그일 거 같은데 말이죠. 제공하신 정보에 의하면, 후자의 경우 최근의 ffmpeg로 업데이트하면 해결될 문제 같습니다.

     

    메타데이터만 바뀐다면 원본 color range를 고려해서 매개변수창(F8)에 -color_range pc 같은 옵션만 추가해 주면 됩니다. 소소한 문제라 굳이 ffmpeg 엔진 자체를 바꿀 필요는 없을 거 같아요.

     

    그런데 만약 원본이 full인데 영상 자체 color range가 limited로 바뀌는 거라면 ffmpeg 엔진 업데이트를 고려해야 할 버그 같네요.

    임시변통으로 필터를 적용해서 color range를 강제하는 방법이 있긴 합니다만... 비디오 필터 부분에 colorspace=bt709:range=pc 를 추가해 주는 거죠(원본이 HDR이 아닌 SDR인 경우).

     

    좀더 정보가 필요한 부분 같습니다.

  • ?
    turquoise 2022.08.01 20:56

    답변 감사합니다.


    출력된 영상을 시청하면 원본과 색감이 다른 문제가 있는데, 색상 범위를 full로 바꾸는 매개변수를 넣어 스트림복사를 한번 진행하고 시청하면 원본과 색감이 같은 것으로 보아 메타데이터만 바뀌는 것으로 추정하고 있습니다.


    ffmpeg 4.4버전과 5.0버전에서 인코딩할 때 원본 영상의 색상 범위를 출력 파일에도 전달하는 -bsf:v h264_metadata=video_full_range_flag=-1 옵션을 사용할 경우 출력 파일의 색상 범위가 바뀌지 않는 것을 보아 사냐인코더의 버그인 것 같아요.

  • ?
    JKyle 2022.08.02 00:03

    실제 버그인지 여부는 해당 영상 샘플과 함께 개발자이신 @Rina 님이 확인해 주셔야 할 문제 같습니다.


    근데 좀 의문인 게, 원본 색상 범위를 그대로 가져오는 건 원래 뭔가 따로 설정할 필요 없이 디폴트가 아닌가 하는 겁니다. 그런데 -bsf:v h264_metadata=video_full_range_flag=-1를 굳이 일부러 따로 강제해도 h264_nvenc로 인코딩을 거치면 무력화된다니, 정말 희한한 문제네요. 이건 샤나의 ffmpeg 엔진 내 h264_nvenc 쪽 문제라고 볼 수밖에 없겠는데요.

     

    그리고 (가능성은 낮겠지만) 혹시 해당 문제가 다른 H.264 인코더인 x264에서도 발생하는지, 또 다른 NVENC 인코더인 hevc_nvenc에서도 발생하는지 등의 여부도 궁금해집니다만, 이건 좀 문제가 복잡해져서 각 잡고 조사해야 할 부분 같군요.

     

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수 추천 수
공지 샤나 사이트 일시 접속 불가 안내 Rina 2024.04.11 1435 0
공지 소리를 4가지로 분리하는 샤나보컬리무버 프로그램을 소개합니다. Rina 2024.03.22 4057 4
공지 샤나인코더 통합 검색 기능 개선(샤나인코더 우측 상단에 있는 검색창을 사용해 보세요.) Rina 2021.09.30 18914 2
공지 자유게시판에서는 자유롭게 글을 작성할 수 있지만 다음과 같은 내용은 삭제돼요 Rina 2020.03.18 16652 5
공지 일반 [필독] 질문 전에 반드시 읽으세요!!! 3 file JKyle 2019.09.16 33007 6
공지 일반 [알림] 질문 먹튀하지 마시기 바랍니다 => 본문 변경 금지 23 JKyle 2018.10.12 28689 16
2270 질문 윈7 이구요 구버전부터 이번신버전까지 인코딩 완료가안됩니다 ㅡㅡ 2 급구여율령 2020.10.19 699 0
2269 질문 wmv 동영상을 mkv로 인코딩할때 오디오관련해서 여쭤봅니다. 2 ㅖㅖ 2020.11.15 699 0
2268 오디오 he-aac2 비트160 정도 주는대 보통얼마나 주나요 5 wet 2015.09.09 700 0
2267 샤나인코더 미리보기화면을 전체화면으로 할수있나요? 2 레빈1 2017.02.28 700 0
2266 [버그?]병합시 첫번째 무음일경우 계속 무음으로 2 jiji 2018.12.08 700 0
2265 예능 드라마 30프레임(29.97) 2500비트레이트 로 만든 프리셋인데 오류가 납니다. 1 file xlvkslwkd 2019.08.14 700 0
2264 인코딩 옵션 질문드립니다 ㅜ 3 file 부렁이 2017.05.06 701 0
2263 일반 인코더가 실행되지 않습니다. 1 베어허그 2021.12.21 701 0
2262 질문 샤나인코더 파일 로드가 안됩니다 1 사용법알켜주세용 2023.06.09 701 0
2261 안녕하세요 음질에 대해 문의드립니다. 1 fjdlsl 2018.07.16 702 0
2260 잘 사용하던 병합하기가 갑자기 안 됩니다ㅠㅠ 3 누리얌 2019.09.04 702 0
2259 질문 일부 영상만 상하반전을 하고 싶습니다. 2 Crazy Ivan 2020.05.29 702 0
2258 질문 ts파일에서 mp4 인코딩 시 오류가 발생 합니다 sniper1093 2020.11.10 702 0
2257 질문 영상 자막과 인코딩 하려는데 1초도 안지나서 오류가 뜨네요 1 EXIA 2020.12.24 702 0
2256 스트림 복사 할때요 처음 시작 할대만 5초정도 정지화면 잇다가 화면 넘어가는대 1 미녀좋아 2016.09.18 703 0
2255 기록보기에서 에러 질문이요 1 이진영 2019.04.29 704 0
2254 질문 설치파일 실행 시 응용 프로그램 오류(0xc000007b)가 발생합니다 Thaddeus 2024.03.03 704 0
2253 기존영상에 자막만 입히려고 하는데요. 1 file 쿠우입니다 2015.09.26 705 0
2252 없던 자막이 자꾸 생깁니다. 1 이이이12 2019.10.03 705 0
2251 avs스크립트를 사용하는데 cpu사용률이 너무 안나옵니다. 2 1ㅇㅇ1 2019.01.03 706 0
Board Pagination Prev 1 ... 43 44 45 46 47 48 49 50 51 52 ... 161 Next
/ 161