View Full Version : Piping 10-bit Avisynth Scripts into ffmpeg for DNxHD or Prores Encoding


Tormaid
31st December 2013, 23:29
Firstly, I hope this is in the right category and everything. This is my first post.

I've been trying to figure out a workflow for my DSLR video for the past few days. Like any responsible encoder, I'd like to start and end with Avisynth. My problem is that (apparently) the only way to output high-bitdepth video from Avisynth is via 10bit builds of x264. That's fine, except that Adobe's h.264 decoder's (I'm working in Premier Pro and After Effects) can'd handle lossless h.264 profiles period, let alone 10-bit ones.

Since there appears to be a vacuum for "professional" lossless intermediary codecs with reasonable compression (if I had unlimited hard drive space, I'd export 16-bit image sequences), I'm willing to settle for editing high-bitrate Prores or DNxHD files. The problem is that I cannot get ffmpeg or any of its branches like ffmbc or Libav to play nice with the dither tools' stacked 10-bit output the way I can with x264.

Any thoughts? Is there some "-input-bitdepth" tag that I'm missing in ffmpeg, or is it more complicated than that?

the_weirdo
1st January 2014, 06:58
You can pipe 10-bit interleaved output as raw with avs2pipemod to FFmpeg, and specify input pixel format, frame size, frame rate for FFmpeg. For example:
avs2pipemod -rawvideo INPUT_YUV422P10_1920x1080.avs|ffmpeg -f rawvideo -pix_fmt yuv422p10le -s 1920x1080 -r 24000/1001 -i pipe:0 -c:v prores OUTPUT.mov
avs2pipemod -rawvideo INPUT_YUV444P10_1920x1080.avs|ffmpeg -f rawvideo -pix_fmt yuv444p10le -s 1920x1080 -r 24000/1001 -i pipe:0 -c:v prores_ks OUTPUT.mov

Tormaid
1st January 2014, 19:44
Please note. Last time I used ffmpeg in such way I get incorrect color matrix. FFmpeg uses PAL for pipe input. But for 2-stage piping (avisynth->h264->ffmpeg Prores) colors can be specified by x264 and result colors are correct.

Interesting. Could I get an example of a two-stage pipe that preserves a Rec.709 curve with full (PC)-range luma?

WorBry
2nd February 2014, 05:27
On the subject of DNxHD encoding with FFMPEG, I understand that Avid DNxHD has, or had, a "Thin Raster" profile DNxHD-TR, specifically for anamorphic 1440 x 1080 HD sources (HDV primarily)

http://community.avid.com/forums/t/60656.aspx

I've come across a past request for DNxHD support in FFMPEG...

https://trac.ffmpeg.org/ticket/2125

....but am not sure what the status is, or, having only just started using FFMPEG, how to go about finding out.

I tried loading a 1440 x 1080 source in ffmpeg (Zeranoe win64-static build 20140125-git-5554c6d), but it was rejected outright.

Anyone know the status? I guess there's less of an incentive for anamorphic HD these days :(

smok3
2nd February 2014, 10:52
@WorBry, maybe ask in
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

Getting same error with (almost) fresh mpv, btw;
mpv dnxhd-tr.mov
Playing: dnxhd-tr.mov
[ffmpeg/video] dnxhd: unsupported cid 1244
Detected file format: QuickTime / MOV (libavformat)
Clip info:
major_brand: qt
minor_version: 537199360
compatible_brands: qt
creation_time: 2013-01-08 23:43:27
timecode: 01:00:00:00
[stream] Video (+) --vid=1 (*) (dnxhd)
[stream] Audio (+) --aid=1 --alang=eng (*) (pcm_s16be)
Using software decoding.
Selected video codec: VC3/DNxHD [lavc:dnxhd]
Selected audio codec: PCM signed 16-bit big-endian [lavc:pcm_s16be]
AO: [pulse] 48000Hz stereo 2ch s16
[ffmpeg/video] dnxhd: unsupported cid 1244
AV: 00:00:00 / 00:00:00 (0%) A-V: 0.000
Error while decoding frame!
[ffmpeg/video] dnxhd: unsupported cid 1244
AV: 00:00:00 / 00:00:00 (0%) A-V: 0.000
Error while decoding frame!
[ffmpeg/video] dnxhd: unsupported cid 1244
AV: 00:00:00 / 00:00:00 (0%) A-V: 0.000
Error while decoding frame!
AV: 00:00:00 / 00:00:00 (0%) A-V: 0.000
Error while decoding frame!
AV: -00:00:00 / 00:00:00 (0%) A-V: 0.000
Error while decoding frame!
AV: -00:00:00 / 00:00:00 (0%) A-V: 0.000
Error while decoding frame!
AV: 00:00:00 / 00:00:00 (17%) A-V: 0.000
Error while decoding frame!
AV: 00:00:00 / 00:00:00 (34%) A-V: 0.000
Error while decoding frame!
AV: 00:00:00 / 00:00:00 (52%) A-V: 0.000


Exiting... (End of file)


mpv --version
mpv git-cd2cfc8 (C) 2000-2014 mpv/MPlayer/mplayer2 projects
built on 2014-01-28T17:30:03
ffmpeg library versions:
libavutil 52.63.100
libavcodec 55.49.101
libavformat 55.28.100
libswscale 2.5.101
libavfilter 4.1.101
libavresample 1.1.0

WorBry
2nd February 2014, 19:48
OK, thanks. I guess if I'm going to be getting into FFMPEG, I should get used to using the appropriate lines of inquiry.