lisamelton / other_video_transcoding

Other tools to transcode videos.
MIT License
555 stars 26 forks source link

--dry-run yields an invalid argument #153

Closed muesic closed 2 years ago

muesic commented 2 years ago

I have an mkv movie called (say) filename.mkv and I do: other-transcode --dry-run --hevc --crop auto --target 480p=1500 --add-subtitle eng filename.mkv

That yields an ffmpeg command line containing: -color_primaries:v smpte170m -color_trc:v smpte170m -colorspace:v smpte170m

and when I run the ffmpeg command the first thing I see is: [hevc_videotoolbox @ 0x7fa6102179c0] Transfer function smpte170m is not supported.

Is that something that needs fixing? I honestly don't know what's going on but it seems a little weird to decode ffmpeg arguments that aren't valid.

Curiously, I have other movies that yield the following slightly different ffmpeg arguments: -color_primaries:v smpte170m -color_trc:v bt709 -colorspace:v smpte170m How come different movies yield different color arguments? I would have thought colors just (effectively) copied across as-is into the output file.

lisamelton commented 2 years ago

@muesic You can ignore that diagnostic message. The VideoToolbox encoder has always weirdly done that.

As for the different arguments, that's because I'm copying the source metadata if it's available. Obviously, your sources sometimes differ in their metadata.

Did that answer your questions?

muesic commented 2 years ago

Yes, thanks. I guess I just didn't understand why the colors wouldn't be "correct" on the DVD in the first place and could therefore just be copied across to the destination as-is. Whatever, I'm not looking to drag you down a rathole :-).

lisamelton commented 2 years ago

Thanks! :)

OK, I'll close this then.

vr8hub commented 1 year ago

@donmelton, I was about to open a similar issue when I thought to search the interwebs, and the only hit for the message turned up here. Should have searched GitHub first, doh!

I, however, don't follow any of the above. What are the parameters on ffmpeg doing, why are they there, and specifically why are they there if Videotoolbox doesn't support them? I have (so far) only seen them on DVD input; I don't have them on Blu-ray input. (By both I mean an .mkv that originated from a DVD or Blu-ray.)

ffmpeg -loglevel error -stats -i ../Movies/DVD/Ever\ After/Ever\ After_t00.mkv -vsync cfr -map 0:0 -c:v h264_videotoolbox -b:v 1500k -color_primaries:v smpte170m -color_trc:v smpte170m -colorspace:v smpte170m -metadata:s:v title\= -disposition:v default -map 0:1 -c:a:0 copy -metadata:s:a:0 title\= -disposition:a:0 default -sn -metadata:g title\= -movflags disable_chpl Ever\ After_t00.mp4
Transcoding...
[h264_videotoolbox @ 0x7fa26b619240] Transfer function smpte170m is not supported.
lisamelton commented 1 year ago

@vr8hub Good questions! But maybe better asked of the team developing either the h264_videotoolbox codec for FFmpeg or VideoToolbox itself at Apple? I suspect the FFmpeg team is rather hamstrung by VideoToolbox being 1) such a black box and 2) its behavior being different on various platforms, e.g. Intel vs. Apple Silicon.

vr8hub commented 1 year ago

Isn't other-transcode generating the ffmpeg command line? I thought that was essentially its raison d'être?

lisamelton commented 1 year ago

@vr8hub Yes. But that command line doesn't always generate esoteric and misleading messages from ffmpeg. It's kinda random. It seems to depend on System Software versions and CPU architectures. 🤷‍♀️

Either way I'm not really worried about it since it doesn't actually cause a problem.

vr8hub commented 1 year ago

It would not appear to be either random nor esoteric, t's pretty plain—the parameter ffmpeg is called with isn't supported by Videotoolbox. But, again, what is that command (smpte170m) supposed to be doing? Why is it there?

vr8hub commented 1 year ago

And why is it present on DVD input but not Blu-ray?

lisamelton commented 1 year ago

@vr8hub Because that's the correct color transfer characteristics for DVD input and output at that resolution. I used the same transform all other encoders. HandBrake works like that as well.

vr8hub commented 1 year ago

OK, so if the "correct color transfer characteristics" don't work, as they don't in this case, then what is impact on the end product, i.e. the encoded movie?

lisamelton commented 1 year ago

@vr8hub Is it not setting the color transfer characteristics?

BTW, which version of other-transcode are you using? Because I fixed a bug with this earlier this year.

vr8hub commented 1 year ago

Oops, sorry, I had that info on the new issue I started, and didn't transfer it over when I found this one. o-t 0.12.0, ffmpeg 5.1.2 (from brew), on Big Sur 11.7.1.

You're asking me? :) This is your deal—how would I know whether it's setting the color transfer characteristics or not? I don't even know what the "color transfer characteristics" are, or what the ramifications of them not being transferred. Hence the questions.

vr8hub commented 1 year ago

On an Intel Mac.

lisamelton commented 1 year ago

@vr8hub You can inspect your transcoded output with MediaInfo or ffprobe to find out whether the correct color transfer characteristics are set.

As far as whether smpte170m should be used for DVD inputs and/or DVD-sized outputs, I'm just going by what's commonly done with other transcoding utilities. For years, actually. But the truth is the difference between DVD and non-HDR Blu-ray color systems is pretty minor. And since most people's display devices (e.g. TVs) are often poorly configured, it's not a big deal. YMMV.