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 > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 22nd July 2011, 23:35   #1  |  Link
Electron.Rotoscope
Registered User
 
Join Date: Aug 2009
Posts: 41
Is there a way to pipe video from quicktime into x264?

I've been having a problem, and I can't seem to find a specific solution for this anywhere.

I want to set up an encoder on a Mac OSX 10.6.7 machine to take command line input and encode quicktime files into H.264/AAC mp4 streams, but unfortunately the quicktime files are all unavoidably encoded using a proprietary codec. I have the decoder installed on the system, Quicktime opens them fine, but it's not a codec supported by libavcodec/ffmpeg, and it's not a codec I can get a library for.
Is there any way to configure ffmpeg to use the system quicktime to feed it frames, or to call an instance of the quicktime component to pipe frames into ffmpeg?

I... know this should go without saying, but no I'm afraid it's not possible to transcode everything in QuickTime Pro to Uncompressed or whatever just so ffmpeg can read them.

If this were a windows system, I'd build ffmpeg with avisynth and use an avs script with "QTSource", but avisynth doesn't build outside of windows I'm told, and I'm also told http://avisynth3.unite-video.com/ is not yet in a usable state and was largely abandoned (is this worth trying to compile to test with?)

If I just needed to make quicktime files, I'd use the x264 build-as-a-QuickTime-component thing from http://www003.upp.so-net.ne.jp/mycometg3/, but it doesn't have all the options I need or presets I'd prefer, and I don't think would work from the command line. And I can't make .mp4s from it.

If I were coming from ProRes, I'd be able to use MPlayer (at least, according to http://doom10.org/index.php?topic=1822.msg8476#msg8476) but as far as I can understand that solution won't work for anything other than ProRes. Though I will try it next.
(and I'm very hesitant to start messing around with Wine)

And I tried ffmbc from http://code.google.com/p/ffmbc/ but it doesn't include what I need

I know that ffmpeg is working, I made sure and built it with libraries for the latest x264 and faac, and I can encode from other sources etc etc. I'm just... at a loss.

Anyone have any ideas? Maybe another program that can decode with quicktime system codecs and send data to x264?





In case it matters:
- The codec I need to decode is called Cineform, though really it's more universally about calling system QT decoders

- The build of ffmpeg I'm using looks like:
ffmpeg version N-31617-g4095fa9, Copyright (c) 2000-2011 the FFmpeg developers
built on Jul 22 2011 18:35:30 with gcc 4.2.1 (Apple Inc. build 5646)
configuration: --enable-gpl --enable-nonfree --enable-libx264 --enable-libmp3lame --enable-libfaac --arch=x86_64 --enable-static --disable-shared
libavutil 51. 11. 0 / 51. 11. 0
libavcodec 53. 8. 0 / 53. 8. 0
libavformat 53. 6. 0 / 53. 6. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 27. 2 / 2. 27. 2
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0


- The command line I just tested with was:
$ ffmpeg -i /Volumes/XXX/master.mov -f mp4 -vcodec libx264 -b 600k /Volumes/XXX/test.mp4

- And the error I got was (in pretty red colours in terminal!):
[buffer @ 0x100f05940] Invalid pixel format string '-1'
Error opening filters!
Electron.Rotoscope is offline   Reply With Quote
Old 22nd July 2011, 23:41   #2  |  Link
Electron.Rotoscope
Registered User
 
Join Date: Aug 2009
Posts: 41
...maybe this is the wrong forum for this. Would this better fit in the ffmpeg or x264 or doom10 or something? My apologies and I'll remove it if so, I guess I'm just used to doom9 being my default for this kind of thing
Electron.Rotoscope is offline   Reply With Quote
Old 23rd July 2011, 01:06   #3  |  Link
kieranrk
Registered User
 
Join Date: Jun 2009
Location: London, United Kingdom
Posts: 707
mplayer can probably output that video to a yuv4mpeg pipe.
kieranrk is offline   Reply With Quote
Old 23rd July 2011, 03:05   #4  |  Link
Electron.Rotoscope
Registered User
 
Join Date: Aug 2009
Posts: 41
So mplayer can call system QuickTime decoders? Ones it doesn't support natively? I'm not really familiar yet with mplayer options, and I'm pretty positive nothing open source can decode it
Electron.Rotoscope is offline   Reply With Quote
Old 23rd July 2011, 03:15   #5  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by Electron.Rotoscope View Post
So mplayer can call system QuickTime decoders? Ones it doesn't support natively? I'm not really familiar yet with mplayer options, and I'm pretty positive nothing open source can decode it
w32codecs is a set of binary decoders mplayer can use, which includes Quicktime decoders.

Some Quicktime proprietary formats do have open source decoders, or will soon (Prores is a WIP).
Dark Shikari is offline   Reply With Quote
Old 23rd July 2011, 04:08   #6  |  Link
Electron.Rotoscope
Registered User
 
Join Date: Aug 2009
Posts: 41
Quote:
Originally Posted by Dark Shikari View Post
w32codecs is a set of binary decoders mplayer can use, which includes Quicktime decoders.

Some Quicktime proprietary formats do have open source decoders, or will soon (Prores is a WIP).

Oh hmm does this allow me to build DirectShow decoders as a library? Or did they actually build a decoder? http://forums.fedoraforum.org/showthread.php?t=254448 gives me hope! I'll report back whether I have any success. Sadly this won't do what I ultimately will need (ie for ProRes, and whatever comes after it etc) but CineForm support is a huge plus!
Electron.Rotoscope is offline   Reply With Quote
Old 23rd July 2011, 11:00   #7  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by Electron.Rotoscope View Post
Sadly this won't do what I ultimately will need (ie for ProRes, and whatever comes after it etc)
What do you ultimately need? ProRes does work in MPlayer with Apple's binary codecs and support for future decoders could be added in the same way.
nm is offline   Reply With Quote
Old 23rd July 2011, 12:17   #8  |  Link
ricardo.santos
Registered User
 
ricardo.santos's Avatar
 
Join Date: Mar 2005
Location: Portugal
Posts: 907
Altough you're using a Mac have you tried batch remuxing the files to mp4 or hdmov?

in the past whenever i had difficulties converting mov i renamed or remuxed it to mp4 and it solved the problem.

here's a link to a bach script (windows though maybe you can adapt it), if you do a bulk rename of the mov extension files to mp4 or hdmov it might work.
ricardo.santos is offline   Reply With Quote
Old 23rd July 2011, 17:48   #9  |  Link
Electron.Rotoscope
Registered User
 
Join Date: Aug 2009
Posts: 41
Quote:
Originally Posted by nm View Post
What do you ultimately need? ProRes does work in MPlayer with Apple's binary codecs and support for future decoders could be added in the same way.
I guess maybe that is what I will need! I'd been searching for a way to link it in ffmpeg, but I'll try to find more information on building .qtx or .ax files into mplayer and post here if I have any success
Electron.Rotoscope is offline   Reply With Quote
Old 23rd July 2011, 18:24   #10  |  Link
Electron.Rotoscope
Registered User
 
Join Date: Aug 2009
Posts: 41
Quote:
Originally Posted by ricardo.santos View Post
Altough you're using a Mac have you tried batch remuxing the files to mp4 or hdmov?

in the past whenever i had difficulties converting mov i renamed or remuxed it to mp4 and it solved the problem.

here's a link to a bach script (windows though maybe you can adapt it), if you do a bulk rename of the mov extension files to mp4 or hdmov it might work.
Ah sadly I think the problem is deeper than that, more to do with the codec itself not being supported, but I'll give that a shot!
Electron.Rotoscope is offline   Reply With Quote
Old 23rd July 2011, 20:21   #11  |  Link
ricardo.santos
Registered User
 
ricardo.santos's Avatar
 
Join Date: Mar 2005
Location: Portugal
Posts: 907
forgot to post the link for the script:

http://forum.videohelp.com/threads/3...ux-FLV-mux-mp4

or use mpeg streamclip to remux mov to mp4
http://www.squared5.com/

its for flv and windows but it might work if you change flv to mov in the script

Last edited by ricardo.santos; 23rd July 2011 at 20:28.
ricardo.santos is offline   Reply With Quote
Old 27th July 2011, 21:29   #12  |  Link
Electron.Rotoscope
Registered User
 
Join Date: Aug 2009
Posts: 41
mplayer syntax problem?

So I'm trying to compile mplayer on Snow Leopard and it is being a horrible little beast... but for the time being I thought I would use the MacPorts version and at least try testing out some uncompressed files.

I'm having problems getting... some part of it to work though. I suspect I have the syntax wrong? I can't find any documentation for using the yuv4mpeg pipe with mplayer.

the input line I'm giving it is
Code:
$ mplayer -nosound -benchmark -vo yuv4mpeg:file=>(x264 --demuxer y4m --bitrate 2000 -o /Volumes/Temp_1/test.264) /Volumes/Asset_1/BARS_I420.avi
And what I get is
Code:
x264 [error]: No input file. Run x264 --help for a list of options.
MPlayer 1.0rc4-4.2.1 (C) 2000-2010 MPlayer Team
158 audio & 340 video codecs

Playing /Volumes/Dam_Asset_1/BARS_I420.avi.
AVI file format detected.
[aviheader] Video stream found, -vid 0
AVI: ODML: Building ODML index (1 superindexchunks).
VIDEO:  [YUY2]  1920x1080  16bpp  23.976 fps  795467.6 kbps (97103.0 kbyte/s)
Using (default) progressive frame mode.==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 0x101870e00]using unscaled yuyv422 -> yuv420p special converter
VO: [yuv4mpeg] 1920x1080 => 1920x1080 Planar YV12 


MPlayer interrupted by signal 13 in module: init_video_codec
Selected video codec: [rawyuy2] vfm: raw (RAW YUY2)
==========================================================================
Audio: no sound
Starting playback...


MPlayer interrupted by signal 13 in module: flip_page

Does this make sense to anyone? Did I write that down right? I'm working under the assumption that it's
Code:
-vo yuv4mpeg:file=>(x264 --various-options) input.avi
but if someone knows the link to the actual documentation for that it'd be amazing

I've also tried the mkfifo method described in http://forum.doom9.org/showthread.ph...94#post1234194 but that didn't work either

Code:
$ mkfifo pip.y4m;x264 pipe.y4m --demuxer y4m --bitrate 2000 -o /Volumes/Temp_1/gLuce/test.264 & mplayer -benchmark -vo yuv4mpeg:file=pipe.y4m -ao null /Volumes/Dam_Asset_1/BARS_I420.avi
[1] 47342
MPlayer 1.0rc4-4.2.1 (C) 2000-2010 MPlayer Team
158 audio & 340 video codecs

Playing /Volumes/Dam_Asset_1/BARS_I420.avi.
x264 [error]: could not open input file `pipe.y4m'
(And then it just ran through the file and exited without outputting anything)

I've never worked with pipes or anything like them before so i could appreciate whatever help I can get.
Note: I'm afraid I need to use mplayer, not ffmpeg or whatever, because i will eventually need to be able to link to .ax binaries on a mac and it seems nothing but mplayer can do that?
Also Note: I'm pretty sure I need to run x264 as its own application, since I don't think ffmpeg or whatever supports all the flags (--bluray-compat from http://www.x264bluray.com/home/1080i-p) for instance

Last edited by Electron.Rotoscope; 27th July 2011 at 21:35.
Electron.Rotoscope is offline   Reply With Quote
Old 27th July 2011, 23:22   #13  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,100
"mkfifo pip.y4m" should probably be "mkfifo pipe.y4m". Also, you cannot redirect the output to a file like you're trying to in the above examples. You either redirect the entire program's stdout or you redirect nothing. IIRC "-" is a special filename that makes the y4m output module write to stdout instead of to a file.

See also http://mplayerhq.hu/DOCS/man/en/mplayer.1.txt
TheFluff is offline   Reply With Quote
Old 27th July 2011, 23:40   #14  |  Link
Electron.Rotoscope
Registered User
 
Join Date: Aug 2009
Posts: 41
Quote:
Originally Posted by TheFluff View Post
"mkfifo pip.y4m" should probably be "mkfifo pipe.y4m". Also, you cannot redirect the output to a file like you're trying to in the above examples. You either redirect the entire program's stdout or you redirect nothing. IIRC "-" is a special filename that makes the y4m output module write to stdout instead of to a file.

See also http://mplayerhq.hu/DOCS/man/en/mplayer.1.txt
Ah thank you I didn't see that! It actually seems to work now! I have to set a framerate and resolution still, or it goes haywire, but hurrah! Now all I have to do is figure out how to get it to simultaneously pipe out the audio! (uhhh...)

Sadly, the man page isn't quite enough information for me, I'm not familiar at all with pipes or mkfifo or anything like that, so the one little paragraph about how to set it for interlaced sources was unfortunately not enough information.

It also doesn't have anything about stdout... could you extrapolate a little? I guess I don't really know what you mean about that.
Electron.Rotoscope is offline   Reply With Quote
Old 28th July 2011, 07:03   #15  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by TheFluff View Post
"mkfifo pip.y4m" should probably be "mkfifo pipe.y4m". Also, you cannot redirect the output to a file like you're trying to in the above examples.
The first command is missing a "-" to let x264 know that it should read standard input:
Code:
mplayer -nosound -benchmark -vo yuv4mpeg:file=>(x264 --demuxer y4m --bitrate 2000 -o p.264 -) dvd1.mkv
The second command (mkfifo ...) also works fine when using the correct filename, as you pointed out. As a minor adjustment, I'd swap x264 and mplayer the other way around so that mplayer is put to background and x264 to foreground. x264 terminates later than mplayer.

In both cases the data flows through a named pipe.

Quote:
Originally Posted by TheFluff View Post
IIRC "-" is a special filename that makes the y4m output module write to stdout instead of to a file.
-vo yuv4mpeg doesn't have that functionality unless it's been recently added and I haven't noticed.
nm is offline   Reply With Quote
Old 28th July 2011, 09:27   #16  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
MediaPlayer Classic (MPC) offers the ability to call Quicktimes video and audio decoders.

I don't know if you can use MPC to serve to other applications though...
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is online now   Reply With Quote
Old 28th July 2011, 12:42   #17  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
What about QuickTime Alternative? AFAIK it makes QuickTime decoders available to the DiretShow framework.

Can't it work with DirectShowSource() or DSS2() in Avisynth? Or maybe deliver the content directly to x264 with DirectShow-enabled builds of x264 (Direct264)?
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 28th July 2011, 14:07   #18  |  Link
Electron.Rotoscope
Registered User
 
Join Date: Aug 2009
Posts: 41
Quote:
Originally Posted by nm View Post
The first command is missing a "-" to let x264 know that it should read standard input:
Code:
mplayer -nosound -benchmark -vo yuv4mpeg:file=>(x264 --demuxer y4m --bitrate 2000 -o p.264 -) dvd1.mkv
The second command (mkfifo ...) also works fine when using the correct filename, as you pointed out. As a minor adjustment, I'd swap x264 and mplayer the other way around so that mplayer is put to background and x264 to foreground. x264 terminates later than mplayer.

In both cases the data flows through a named pipe.
Cool thanks, I'll try that out! Would you recommend one over the other? Or should I just do my own speed tests?

Oh hey, could I do something like

Code:
mplayer -benchmark -vo yuv4mpeg:file=>(x264 --demuxer y4m --bitrate 2000 -o vid.264 -) -ao pcm:fast:file=>(NeroAacEnc -ignorelength -cbr 96000 -if - -of aud.aac) source.avi
to feed to separate audio and video tracks at the same time?

Last edited by Electron.Rotoscope; 28th July 2011 at 14:21. Reason: code improvements
Electron.Rotoscope is offline   Reply With Quote
Old 28th July 2011, 14:13   #19  |  Link
Electron.Rotoscope
Registered User
 
Join Date: Aug 2009
Posts: 41
Quote:
Originally Posted by LoRd_MuldeR View Post
What about QuickTime Alternative? AFAIK it makes QuickTime decoders available to the DiretShow framework.

Can't it work with DirectShowSource() or DSS2() in Avisynth? Or maybe deliver the content directly to x264 with DirectShow-enabled builds of x264 (Direct264)?
Ah if only! Unfortunately I need a solution that runs in Mac/OSX also, and I'm told that AviSynth is unusable on OSX due to a lack of VFW (not that I claim to know what that is). If I had avisynth, I could even just run QTSource and be done with it! It's frustrating actually, knowing that I only need this framework for this one "QTSource" command but that I can't even do that.

I haven't heard of Direct264, can it be compiled on a system that doesn't have directshow itself?

Unfortunately QuickTime Alternative does sort of the opposite of what I need, I'd like to be able to use proprietary .qtx style decoder binaries that can only come from the manufacturers (aka the ones for Cineform HD or RED3D or ProRes 4444) that the open source community has not yet reverse engineered. In a perfect world, all my sources would be uncompressed AVI, or at least something easy to decode, but alas such is life.
Also I think QT Alternative is Windows-Only

Edit:

Actually you know what, QT Alternative would be fantastically useful if I ever need to decode like ProRes4444 with something that only takes DirectShow, I'll definitely keep it in mind if that ever comes up!

Last edited by Electron.Rotoscope; 28th July 2011 at 14:24.
Electron.Rotoscope is offline   Reply With Quote
Old 28th July 2011, 14:19   #20  |  Link
Electron.Rotoscope
Registered User
 
Join Date: Aug 2009
Posts: 41
Quote:
Originally Posted by SeeMoreDigital View Post
MediaPlayer Classic (MPC) offers the ability to call Quicktimes video and audio decoders.

I don't know if you can use MPC to serve to other applications though...
Ah sadly Windows-only again... sigh life is so hard. Forced cruelly to use this giant beast of a Final Cut Pro system *weep* *wail*
Electron.Rotoscope is offline   Reply With Quote
Reply

Tags
cineform, ffmpeg, mp4, x264

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 11:56.


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