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 > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th February 2016, 21:29   #1  |  Link
WorBry
Registered User
 
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
VSPipe: how to input audio?

Another newbie VapourSynth/ffmpeg question.

I have this basic script and VSPipe set-up for transcoding native HD AVC.mov clips, recorded on a DSLR camera, to UTVideo:

Code:
import vapoursynth as vs
core = vs.get_core()
clip = core.ffms2.Source("Path....../DSCN0968.MOV")
..Other YV12 filtering... 
clip = core.std.AssumeFPS(clip,fpsnum=30000,fpsden=1001)
clip.set_output()
Pipe:
Code:
vspipe Path...../YV12Fullscale.vpy - | ffmpeg -f rawvideo -pix_fmt yuv420p -s 1920x1080 -r 30000/1001 -i pipe: -vcodec utvideo Path....../DSCN0968_VSP_UTVYV12FS.mkv
And equivalent set-up for transcoding to 4:2:2 formats (UTVideo, DNxHD etc)

Code:
import vapoursynth as vs
core = vs.get_core()
clip = core.ffms2.Source("Path....../DSCN0968.MOV")
..Other YV12 filtering... 
clip = core.fmtc.resample (clip, css="422")
clip = core.fmtc.bitdepth (clip, bits=8)
clip = core.std.AssumeFPS(clip,fpsnum=30000,fpsden=1001)
clip.set_output()
Pipe:
Code:
vspipe Path...../YV12Fullscale.vpy - | ffmpeg -f rawvideo -pix_fmt yuv422p -s 1920x1080 -r 30000/1001 -i pipe: -vcodec utvideo Path....../DSCN0968_VSP_UTVYUY2FS.mkv
The clips are recorded with full range (0-255) YV12 luma and this way the scaling is preserved. The native audio is PCM.

My newbie question is - how/where in the pipe set-up can I feed in the source PCM audio path to get the muxed output?
__________________
Nostalgia's not what it used to be

Last edited by WorBry; 13th February 2016 at 21:34.
WorBry is offline   Reply With Quote
Old 13th February 2016, 22:10   #2  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
VapourSynth doesn't do audio. If you pipe the video from VSPipe to FFmpeg, you'll need to add the audio from a separate file...

(FFmpeg can take multiple sources, just use "-i" as often as needed)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 13th February 2016 at 22:12.
LoRd_MuldeR is offline   Reply With Quote
Old 13th February 2016, 23:50   #3  |  Link
WorBry
Registered User
 
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
Quote:
Originally Posted by LoRd_MuldeR View Post
VapourSynth doesn't do audio. If you pipe the video from VSPipe to FFmpeg, you'll need to add the audio from a separate file...
Yes, that's what I was asking - how to do it ? :

Quote:
Originally Posted by WorBry View Post
.. how/where in the pipe set-up can I feed in the source PCM audio path to get the muxed output?
(FFmpeg can take multiple sources, just use "-i" as often as needed)[/QUOTE]

That's what I thought - but taking that first YV12 example again:

Code:
import vapoursynth as vs
core = vs.get_core()
clip = core.ffms2.Source("Path....../DSCN0968.MOV")
..Other YV12 filtering... 
clip = core.std.AssumeFPS(clip,fpsnum=30000,fpsden=1001)
clip.set_output()
If I copy in the audio from the original clip like:

Code:
vspipe Path...../YV12Fullscale.vpy - | ffmpeg -f rawvideo -pix_fmt yuv420p -s 1920x1080 -r 30000/1001 -i pipe: -vcodec utvideo -i Path....DSCN0968.MOV -acodec copy   Path....../DSCN0968_VSP_UTVYV12FS.mkv
I get this:

Quote:
~$ vspipe /home/bryan/Documents/YV12Fullscale.vpy - | ffmpeg -f rawvideo -pix_fmt yuv420p -s 1920x1080 -r 30000/1001 -i pipe: -vcodec utvideo -i /home/bryan/Videos/DSCN0968.MOV -acodec copy /home/bryan/Videos/DSCN0968_VSP_utvideoYV12FS.avi
ffmpeg version 2.7.6-0ubuntu0.15.10.1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.2.1 (Ubuntu 5.2.1-22ubuntu2) 20151010
configuration: --prefix=/usr --extra-version=0ubuntu0.15.10.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-frei0r --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-openal --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libxvid --enable-libzvbi --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-libssh --enable-libsoxr --enable-libx264 --enable-libopencv --enable-libx265
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, rawvideo, from 'pipe:':
Duration: N/A, start: 0.000000, bitrate: 745750 kb/s
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 745750 kb/s, 29.97 tbr, 29.97 tbn, 29.97 tbc
[utvideo @ 0x217e120] Frame info not 4 bytes is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[utvideo @ 0x217e120] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
[utvideo @ 0x217e120] Unknown Ut Video FOURCC provided (31637661)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x217c9a0] Failed to open codec in av_find_stream_info
[utvideo @ 0x217e120] Frame info not 4 bytes is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[utvideo @ 0x217e120] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
[utvideo @ 0x217e120] Unknown Ut Video FOURCC provided (31637661)

Guessed Channel Layout for Input Stream #1.1 : stereo
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/home/bryan/Videos/DSCN0968.MOV':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt niko
creation_time : 2016-01-22 15:51:53
Duration: 00:00:06.01, start: 0.000000, bitrate: 17065 kb/s
Stream #1:0(eng): Video: utvideo (avc1 / 0x31637661), none(bt709), 1920x1080, 15414
Metadata:
creation_time : 2016-01-22 15:51:53
encoder : AVC Coding
Stream #1:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 2 channels, s16, 1
Metadata:
creation_time : 2016-01-22 15:51:53
Output #0, avi, to '/home/bryan/Videos/DSCN0968_VSP_utvideoYV12FS.avi':
Metadata:
ISFT : Lavf56.36.100
Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080, q=2-31, 200 kb/s,
Metadata:
encoder : Lavc56.41.100 mpeg4
Stream #0:1(eng): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, 1536 k
Metadata:
creation_time : 2016-01-22 15:51:53
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Stream #1:1 -> #0:1 (copy)
[rawvideo @ 0x2173240] Thread message queue blocking; consider raising the thread_queue_
Output 180 frames in 1.73 seconds (104.01 fps)e=00:00:05.50 bitrate=3891.9kbits/s
frame= 180 fps=112 q=31.0 Lsize= 2812kB time=00:00:06.00 bitrate=3835.9kbits/s
video:1666kB audio:1126kB subtitle:0kB other streams:0kB global headers:0kB muxing overh
The pipe worked fine without the audio bit. So something's not right.
__________________
Nostalgia's not what it used to be

Last edited by WorBry; 13th February 2016 at 23:57.
WorBry is offline   Reply With Quote
Old 14th February 2016, 00:38   #4  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
try vspipe with -y

Code:
└───╼  vspipe -y test.vpy - | ffmpeg -i pipe: -i test.mp4 -c:v utvideo -c:a copy -map 0:0 -map 1:1 esee.mkv -y
ffmpeg version 2.8.6 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gnutls --enable-gpl 
 --enable-ladspa --enable-libass --enable-libbluray --enable-libdcadec --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb
 --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2
 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-shared --enable-version3 --enable-x11grab
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, yuv4mpegpipe, from 'pipe:':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41isomavc1
    creation_time   : 2013-02-11 10:03:12
  Duration: 00:01:30.72, start: 0.046440, bitrate: 2654 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2493 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      creation_time   : 2013-02-11 10:03:12
      handler_name    : L-SMASH Video Handler
      encoder         : AVC Coding
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 157 kb/s (default)
    Metadata:
      creation_time   : 2013-02-11 10:03:12
      handler_name    : L-SMASH Audio Handler
[matroska @ 0x55d394354a00] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, matroska, to 'esee.mkv':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: utvideo (ULY0 / 0x30594C55), yuv420p, 1280x720, q=2-31, 200 kb/s, 23.98 fps, 1k tbn, 23.98 tbc
    Metadata:
      encoder         : Lavc56.60.100 utvideo
    Stream #0:1(und): Audio: aac ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, 157 kb/s (default)
    Metadata:
      creation_time   : 2013-02-11 10:03:12
      handler_name    : L-SMASH Audio Handler
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> utvideo (native))
  Stream #1:1 -> #0:1 (copy)
[yuv4mpegpipe @ 0x55d39433e0e0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
Output 2175 frames in 37,21 seconds (58,45 fps)=00:01:29.63 bitrate=73495.4kbits/s    
frame= 2175 fps= 59 q=-0.0 Lsize=  812262kB time=00:01:30.76 bitrate=73309.1kbits/s    
video:810391kB audio:1746kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.015315%
or update your ffmpeg like say in your ffmpeg message
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff

Last edited by sl1pkn07; 14th February 2016 at 04:54.
sl1pkn07 is offline   Reply With Quote
Old 14th February 2016, 00:55   #5  |  Link
dontrythisathome
Registered User
 
Join Date: Feb 2014
Location: Italy
Posts: 22
Try to specify files streams using -map option .

In your case.

Code:
vspipe -y Path...../YV12Fullscale.vpy - | ffmpeg -i - -i Path....DSCN0968.MOV \
-map 0:v -map 1:a \
-c:v utvideo \
-c:a copy \ 
-y Path....../DSCN0968_VSP_UTVYV12FS.mkv
dontrythisathome is offline   Reply With Quote
Old 14th February 2016, 15:59   #6  |  Link
WorBry
Registered User
 
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
Quote:
Originally Posted by sl1pkn07 View Post
...try vspipe with -y
Thanks, yes that works:

Code:
vspipe -y path......./YV12Fullscale.vpy - | ffmpeg -i pipe: -i path.../DSCN0968.MOV -c:v utvideo -c:a copy -map 0:0 -map 1:1 path...../DSCN0968_VSP_utvideoYV12FS.avi -y
I had this notion that the
Code:
ffmpeg -f rawvideo -pix_fmt yuv420p -s 1920x1080 -r 30000/1001 -i pipe:
part of my original pipe string had to fit in somewhere, but evidently not.

First time I tried it though, I kept getting this message:

Quote:
[yuv4mpegpipe @ 0x1c78ec0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Tried using a longer test clip, but the same thing. This was using ffmpeg 7:2.7.6-Oubuntu0.15.10.1 on Kubuntu 15.10 (64 AMD). Tried again on Mint 17.3 (which I have installed along side Kubuntu). Mint doesn't come with ffmpeg, so I'd installed 7:2.8.6+git1-trusty from ppa:mc3man/trusty-media. Then it worked OK. Only message I'm seeing part way through the encode is:
Quote:
[yuv4mpegpipe @ 0x3a1a7c0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
I need to look at that.

So, yes, thanks for the tip about using -map option. Can't say I completely understand at this point how the -y thing works but I'll try and get my ahead around it. I need to learn these things if I'm going to get any further with ffmpeg.

Cheers.

Edit: Just noticed this recent thread on the same subject:

http://forum.doom9.org/showthread.ph...th+pipe+ffmpeg

So I'm not alone in working through issues like this.
__________________
Nostalgia's not what it used to be

Last edited by WorBry; 15th February 2016 at 03:42.
WorBry is offline   Reply With Quote
Reply

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 09:18.


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