[FFmpeg-user] Piping output of ffmpeg into ffmbc

Erik Dobberkau erik.dobberkau at gmail.com
Tue Aug 23 10:45:02 EEST 2016


2016-08-22 23:39 GMT+02:00 Keith Reilly <kreilly at retroreport.com>:

> On Sat, Aug 20, 2016 at 7:41 AM, Erik Dobberkau <erik.dobberkau at gmail.com>
> wrote:
>
> > 2016-08-19 22:43 GMT+02:00 Keith Reilly <kreilly at retroreport.com>:
> >
> > > wrote:
> > >
> > > > > > 2016-08-18 23:23 GMT+02:00 Paul B Mahol <onemda at gmail.com>:
> > > > > >
> > > > > > > On 8/18/16, Keith Reilly <kreilly at retroreport.com> wrote:
> > > > > > > > I use ffmbc to create Avid supported files for fast import
> > > (ffmpeg
> > > > > > > doesn't
> > > > > > > > do this). ffmbc is behind in development so there are codecs
> it
> > > > > cannot
> > > > > > > read
> > > > > > > > that i need it to. My solution is to simply read the file
> with
> > > > ffmpeg
> > > > > > and
> > > > > > > > pass it on to ffmbc via standard output that way i can make
> > Avid
> > > > > media
> > > > > > > with
> > > > > > > > anything ffmpeg reads. However i have an issue. I do not get
> > the
> > > > > whole
> > > > > > > > video converted.
> > > > > > > >
> > > > > > > >  I'm running on Mac os 10.11.6 ffmpeg was installed with
> > > macports,
> > > > > > ffmbc
> > > > > > > > from source. The video is about 1 hour 27 min long, i get
> > > roughly 5
> > > > > > > minutes
> > > > > > > > of the imx50 file that is perfect except for the missing hour
> > and
> > > > > > 22min.
> > > > > > > >
> > > > > > > > console input:
> > > > > > > > ffmpeg -i _Youtube.webm -c:v rawvideo -c:a pcm_s16le -f avi
> > > pipe:1
> > > > |
> > > > > > > ffmbc
> > > > > > > > -i pipe:0 -r 29.97 -target imx50 _Youtube.mxf
> > > > > > > >
> > > > > > > > output:
> > > > > > > >
> > > > > > > > ffmpeg version 3.1.1 Copyright (c) 2000-2016 the FFmpeg
> > > developers
> > > > > > > >
> > > > > > > >   built with Apple LLVM version 7.3.0 (clang-703.0.31)
> > > > > > > >
> > > > > > > >   configuration: --prefix=/opt/local --enable-swscale
> > > > > --enable-avfilter
> > > > > > > > --enable-avresample --enable-libmp3lame --enable-libvorbis
> > > > > > > --enable-libopus
> > > > > > > > --enable-libtheora --enable-libschroedinger
> > --enable-libopenjpeg
> > > > > > > > --enable-libmodplug --enable-libvpx --enable-libsoxr
> > > > > --enable-libspeex
> > > > > > > > --enable-libass --enable-libbluray --enable-lzma
> > --enable-gnutls
> > > > > > > > --enable-fontconfig --enable-libfreetype --enable-libfribidi
> > > > > > > > --disable-indev=jack --disable-outdev=xv
> > > > > --mandir=/opt/local/share/man
> > > > > > > > --enable-shared --enable-pthreads --cc=/usr/bin/clang
> > > --enable-vda
> > > > > > > > --enable-audiotoolbox --enable-videotoolbox --arch=x86_64
> > > > > --enable-yasm
> > > > > > > > --enable-gpl --enable-postproc --enable-libx264
> > --enable-libxvid
> > > > > > > >
> > > > > > > >   libavutil      55. 28.100 / 55. 28.100
> > > > > > > >
> > > > > > > >   libavcodec     57. 48.101 / 57. 48.101
> > > > > > > >
> > > > > > > >   libavformat    57. 41.100 / 57. 41.100
> > > > > > > >
> > > > > > > >   libavdevice    57.  0.101 / 57.  0.101
> > > > > > > >
> > > > > > > >   libavfilter     6. 47.100 /  6. 47.100
> > > > > > > >
> > > > > > > >   libavresample   3.  0.  0 /  3.  0.  0
> > > > > > > >
> > > > > > > >   libswscale      4.  1.100 /  4.  1.100
> > > > > > > >
> > > > > > > >   libswresample   2.  1.100 /  2.  1.100
> > > > > > > >
> > > > > > > >   libpostproc    54.  0.100 / 54.  0.100
> > > > > > > >
> > > > > > > > FFmbc version 0.7.4
> > > > > > > >
> > > > > > > > Copyright (c) 2008-2015 Baptiste Coudurier and the FFmpeg
> > > > developers
> > > > > > > >
> > > > > > > > Input #0, matroska,webm, from '/Volumes/RR295-KENNEDY_1/_
> > > > > > Youtube.webm':
> > > > > > > >
> > > > > > > >   Metadata:
> > > > > > > >
> > > > > > > >     encoder         : Lavf56.1.0
> > > > > > > >
> > > > > > > >   Duration: 01:27:33.64, start: 0.000000, bitrate: 480 kb/s
> > > > > > > >
> > > > > > > >     Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv),
> > > 640x480,
> > > > > SAR
> > > > > > > 1:1
> > > > > > > > DAR 4:3, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default)
> > > > > > > >
> > > > > > > >     Stream #0:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp
> > > > (default)
> > > > > > > >
> > > > > > > > [avi @ 0x7fcd6c83f000] Using AVStream.codec to pass codec
> > > > parameters
> > > > > to
> > > > > > > > muxers is deprecated, use AVStream.codecpar instead.
> > > > > > > >
> > > > > > > >     Last message repeated 1 times
> > > > > > > >
> > > > > > > > Output #0, avi, to 'pipe:1':
> > > > > > > >
> > > > > > > >   Metadata:
> > > > > > > >
> > > > > > > >     ISFT            : Lavf57.41.100
> > > > > > > >
> > > > > > > >     Stream #0:0(eng): Video: rawvideo (I420 / 0x30323449),
> > > yuv420p,
> > > > > > > 640x480
> > > > > > > > [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn,
> > 29.97
> > > > tbc
> > > > > > > > (default)
> > > > > > > >
> > > > > > > >     Metadata:
> > > > > > > >
> > > > > > > >       encoder         : Lavc57.48.101 rawvideo
> > > > > > > >
> > > > > > > >     Stream #0:1(eng): Audio: pcm_s16le ([1][0][0][0] /
> 0x0001),
> > > > 44100
> > > > > > Hz,
> > > > > > > > stereo, s16, 1411 kb/s (default)
> > > > > > > >
> > > > > > > >     Metadata:
> > > > > > > >
> > > > > > > >       encoder         : Lavc57.48.101 pcm_s16le
> > > > > > > >
> > > > > > > > Stream mapping:
> > > > > > > >
> > > > > > > >   Stream #0:0 -> #0:0 (vp9 (native) -> rawvideo (native))
> > > > > > > >
> > > > > > > >   Stream #0:1 -> #0:1 (vorbis (native) -> pcm_s16le (native))
> > > > > > > >
> > > > > > > > Press [q] to stop, [?] for help
> > > > > > > >
> > > > > > > > Input #0, avi, from 'pipe:0':
> > > > > > > >
> > > > > > > >   Metadata:
> > > > > > > >
> > > > > > > >     encoder: Lavf57.41.100
> > > > > > > >
> > > > > > > >   Duration: 9951:59:45.52, bitrate: N/A
> > > > > > > >
> > > > > > > >     Stream #0.0(und): Video: rawvideo, yuv420p, 640x480p, PAR
> > 1:1
> > > > DAR
> > > > > > > 4:3,
> > > > > > > > 29.97 fps
> > > > > > > >
> > > > > > > >     Stream #0.1(und): Audio: pcm_s16le, 44100 Hz, 2 channels,
> > > s16,
> > > > > 1411
> > > > > > > kb/s
> > > > > > > >
> > > > > > > > [scale @ 0x7fde69c03a00] w:640 h:480 fmt:yuv420p -> w:640
> h:480
> > > > > > > fmt:yuv422p
> > > > > > > > flags:0x4 il:0
> > > > > > > >
> > > > > > > > Auto-rescaling to imx50 resolution
> > > > > > > >
> > > > > > > > [scale @ 0x7fde69c038a0] w:640 h:480 fmt:yuv420p -> w:720
> h:486
> > > > > > > fmt:yuv422p
> > > > > > > > flags:0x4 il:-1
> > > > > > > >
> > > > > > > > [pad @ 0x7fde69c03cc0] w:720 h:486 -> w:720 h:512 x:0 y:26
> > > > > > > > color:0x108080FF[yuva]
> > > > > > > >
> > > > > > > > Output #0, mxf_d10, to '/Volumes/RR295-KENNEDY_1/_
> > Youtube.mxf':
> > > > > > > >
> > > > > > > >   Metadata:
> > > > > > > >
> > > > > > > >     encoder: FFmbc 0.7
> > > > > > > >
> > > > > > > >     Stream #0.0(und): Video: mpeg2video, yuv422p, 720x512i
> tff
> > > [PAR
> > > > > > > 128:135
> > > > > > > > DAR 4:3], cbr, 50000 kb/s, 29.97 fps
> > > > > > > >
> > > > > > > >     Stream #0.1(und): Audio: pcm_s16le, 48000 Hz, 2 channels,
> > > s16,
> > > > > 1536
> > > > > > > kb/s
> > > > > > > >
> > > > > > > > Stream mapping:
> > > > > > > >
> > > > > > > >   Stream #0.0 -> #0.0
> > > > > > > >
> > > > > > > >   Stream #0.1 -> #0.1
> > > > > > > >
> > > > > > > > frame=157451 fps=212 q=-0.0 Lsize=71762491kB time=01:27:33.64
> > > > > > > > bitrate=111899.2kbits/s speed=7.09x
> > > > > > > >
> > > > > > > > video:70852950kB audio:905022kB subtitle:0kB other
> streams:0kB
> > > > global
> > > > > > > > headers:0kB muxing overhead: 0.006298%
> > > > > > > >
> > > > > > > > frame= 9202 fps= 12 q=1.0 Lsize= 2346517kB time=00:05:07.04
> > > > > > > > bitrate=62606.4kbits/s
> > > > > > > >
> > > > > > > > video:1874018kB audio:57571kB global headers:0kB muxing
> > overhead
> > > > > > > 21.481172%
> > > > > > > >
> > > > > > > > Homicidal-Psycho-Jungle-Cat: keithreilly$
> > > > > > >
> > > > > > > Not our bug.
> > > > > > > _______________________________________________
> > > > > > > ffmpeg-user mailing list
> > > > > > > ffmpeg-user at ffmpeg.org
> > > > > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> > > > > > >
> > > > > > > To unsubscribe, visit link above, or email
> > > > > > > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> > > > > > >
> > > > > > _______________________________________________
> > > > > > ffmpeg-user mailing list
> > > > > > ffmpeg-user at ffmpeg.org
> > > > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> > > > > >
> > > > > > To unsubscribe, visit link above, or email
> > > > > > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> > > > > >
> > > > >
> > > >
> > > >
> > > > > On Fri, Aug 19, 2016 at 7:10 AM, Erik Dobberkau <
> > > > erik.dobberkau at gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Hi Keith,
> > > > > >
> > > > > > you don't need ffmbc to create IMX MXF OP1a that can be read by
> > Avid,
> > > > you
> > > > > > can do this with ffmpeg alone. I guess you also mean AMA linking,
> > not
> > > > > fast
> > > > > > importing, right? (I'm testing on MC 7.0.5 here and the only way
> to
> > > get
> > > > > an
> > > > > > MXF file into the project is AMA linking)
> > > > > > What ffmpeg can't do atm (or I'm just doing it wrong), is create
> > > > OP-Atom
> > > > > > files that Avid accepts.
> > > > > >
> > > > > > The command most sites link to (the old ffmpeg_howto) is correct
> > (in
> > > > Avid
> > > > > > terms) for the most part, but you need to pad your scaled
> (active)
> > > > video
> > > > > > with 32 VBI lines (black) at the top. You also need to manipulate
> > > your
> > > > > > audio to meet IMX standards.
> > > > > >
> > > > > > Erik
> > > > > >
> > > > >
> > > >
> > > > > 2016-08-19 17:17 GMT+02:00 Keith Reilly <kreilly at retroreport.com>:
> > > > > Erik,
> > > > > I was specifically thinking of fast import. I haven't been able to
> > get
> > > > > ffmpeg to create media for fast import, thats why i'm using ffmbc.
> > Am I
> > > > > correct in understanding that for fast import ffmpeg will not work?
> > > That
> > > > is
> > > > > what i have read and all my experiments with ffmpeg to create media
> > for
> > > > > fast import have failed.
> > > > >
> > > > > This is the first time i am trying to pipe the output of ffmpeg
> and i
> > > > > thought maybe there was something wrong with my command that was
> > > causing
> > > > > the error. I guess this is not the case and i'll just have to
> > > experiment.
> > > > > Thanks.
> > > > >
> > > > > Keith
> > > >
> > > > Keith,
> > > >
> > > > What MediaComposer version are you running? And you can right-click
> in
> > > your
> > > > bin, choose "Import..." and import a MXF file (created with ffmbc)?
> > > > Seriously?
> > > > Because I can't - just do AMA linking (and transcode afterwards). The
> > > only
> > > > file (containers) I know of to perform fast imports are QuicktTime
> > MOVs.
> > > >
> > > > Erik
> > > >
> > >
> > > sorry for the top post. didn't realize that was part of the etiquette
> and
> > > didn't even know what top post meant.
> > > Erik,
> > >    As far as fast importing into avid i have been able to do this with
> > avid
> > > 7 and 8 with the method you just described, right-click in a bin choose
> > > import and just select what drive you want it to copy the media. It
> does
> > > the fast import, re-wrap no transcoding. This is the command i use:
> > 'ffmbc
> > > -i <input file> -r 29.97 -target imx50 <output file>.mxf' - make sure
> you
> > > end the output file with '.mxf'
> > > Although ffmbc also supports XDCam it always errors out on me because
> > there
> > > aren't 8 channels of audio. imx50 works fine for my purposes. The only
> > road
> > > block is ffmbc doesn't open webm videos and a few others. Thats why i'm
> > > trying to use ffmpeg to decode and pipe it to ffmbc. Also i've only
> tried
> > > this with standard def material. don't know what will happen with high
> > def.
> > > I"m working from an archive
> > >
> > >
> > Keith,
> >
> > I've run a few tests here, atm MC will import both ffmbc and
> > ffmpeg-generated MXF (I just had wrong MC settings), but neither imports
> as
> > "fast-import", though it's quite speedy (1:30 imports in 3 secs, but the
> > progress dialog doesn't say "fast import"). Anyhoo.
> > What I found out is ffmpeg IMX50 is a (few) bit(s) different from ffmbc
> > IMX50, there's a 512byte offset difference of the position of the first
> > packet in the file (ffmpeg's header being shorter), but everything else
> can
> > be tuned to be identical as far as I can see here atm.
> > Also, there seems to be a slight deviation from the IMX standard in
> ffmbc,
> > because by default it outputs 4ch audio, each with 16 bits word length,
> in
> > one stream, but to my knowledge it should be 24 bits when using 4ch only,
> > but I don't know if this is optional or mandatory.
> >
> > When using HD, ffmpeg does generate pretty decent XDCAM-HD422 when tuned
> > correctly, I did an import comparison with original PDW-700 footage, it's
> > also the same speed, but neither is being prompted as "fast import". Gee.
> >
> > Sorry not to be a better help here.
> >
>
> Erik,
>       So the reason i think why the 1:30 imports in 3 seconds is because
> Avid is re-wrapping the file and not transcoding, basically a fast import.
>

Hi Keith,
I agree, but I didn't want to jump to conclusions. ;-)
A comparison I did revealed that a normal import would take 1 minute, so
it'd be fair to say we have a fast import here.


> The prompt on my screen does not say fast import either however i know its
> not transcoding the files over again because of two things, my system is
> not capable of transcoding files as fast as it's importing them, and
> secondly on the import window Avid will ignore any target codec i set in
> the options dialog. So if i import the mxf files that ffmbc creates and
> select dnxhd 100 the files will stay in imx50 format. To my knowledge Avid
> only behaves like that on fast imports.


It only does that if you have selected "do not resize smaller images" in a
(U)HD project.
Otherwise MC will try to scale up, thus re-encode, your video.


> My goal here is two things, make it faster to import media into Avid and
> not go down a generation by
> transcoding. With the files i made with ffmbc i did not get the same
> results. Avid would transcode the video again. Slower imports and also
> obviously going down another generation, which i know the second reason
> isn't that big a deal.


Let's say it depends. :-D


> I'm curious if the files you are tweaking with
> ffmpeg import as quickly as with ffmbc. You didn't specify they both
> imported just as fast but it was implied. Is that the case?


In terms of the precision of a stop watch, yes.


> What is the
> command you are using with ffmpeg to get the almost identical file that
> ffmbc makes? If i could just stick with ffmpeg to decode and encode this
> would solve my problem. Thanks for the feedback and input.
>
> Keith
>

With the (as of testing a few days ago) latest ffmpeg Win build (3.0.2) my
command was
(input file is a 16:9 progressive h.264/aac-stereo video)

ffmpeg -i [inputfile.ext] \
-vf
"scale=720:576:interl=0:in_color_matrix=bt709:out_color_matrix=bt601,pad=720:608:0:32,tinterlace=4:flags=vlpf,setdar=16/9"
\
-c:v mpeg2video -pix_fmt yuv422p -r 25 -b:v 50M -minrate 50M -maxrate 50M
-bufsize 2M -rc_init_occupancy 2M -intra -flags +ildct+low_delay \
-intra_vlc 1 -non_linear_quant 1 -ps 1 -qmin 1 -qmax 3 -top 1 -dc 10 \
[-rc_max_vbv_use 1 -rc_min_vbv_use 1 -rc_buf_aggressivity 0.25] \
-c:a pcm_s24le -ar 48000 -d10_channelcount 4  \
 -f mxf_d10 [outputfile.mxf]

Obviously, this is for PAL video. For NTSC video, you will have to alter
the vertical size scale filter to 480, the vertical size on the padding
filter to 512, and the rate to 29.97 . If your source video is interlaced,
I recommend starting the -vf chain with w3fdif, and then scale -- vf usage
always depending on the source video, of course.
In my tests, leaving out the options in brackets (on line 5) wouldn't make
a difference, maybe it does for you (feedback welcome, as always). Every
other (video) option is mandatory, otherwise MediaComposer will not be able
to display the video (though it imports the file without warnings or
errors). Depending on your input file's audio channel layout, you may need
to merge the audio channels into one stream (4ch at 24bit or 8ch at 16bit max.),
but for a stereo source you can go without any complex filters.

Let me know how it goes.

Erik


More information about the ffmpeg-user mailing list