View Full Version : Alternative to TCPdeliver (TCPserver / TCPsource)
konstantin1
4th January 2016, 19:18
I would like to decode the video content on my VPS and frameserving it to my PC. I tried avisynth TCPdeliver plugin (TCPserver / TCPsource) but the net bandwidth is a bottleneck (320 Kbytes/sec). I would like to try any other similar plugin / program for frameserving through TCP / HTTP connection which supports MJPEG compression. Unfortunately TCPdeliver doesn't support it. I need only preview the videos and seek through them, maybe extracting certain segments to separate files. Avisynth solution is preferable because I can open .avs file with VirtualDub. Linux or Windows programs are also acceptable for me, if it works with Wine.
konstantin1
6th January 2016, 14:42
Maybe with the help of the DSynth plugin? http://esby.free.fr/prog/dsynth/
Wilbert
7th January 2016, 20:55
Did you try any of the compression modes?
raffriff42
8th January 2016, 02:57
TCPServer (http://avisynth.nl/index.php/TCPServer) only supports codecs with relatively low compression. I would try ffmpeg:After a few tries, I got ffmpeg to stream to VLC Player:
ffmpeg -i %file% -c:v mpeg2video -q:v 1 -qmin 1 -pix_fmt yuv420p -c:a ac3 -q:a 0.35 -f mpegts "tcp://127.0.0.1:2000?listen"
This could be tuned for quite low bitrates. Don't know if ffmpeg can work in your situation though.
konstantin1
8th January 2016, 21:32
Yes, I tried the compression modes (LZO, Huffman, GZip), I think one of them is the default, but I tried the other two as well. Still very slow to seek through the whole video.
Then I tried to convert the whole video to mjpeg. Server side:
ffmpeg -i video.mp4 -vf "scale=320:240" -c:v mjpeg -q 5 -an -f avi tcp://my.vps.ip.address:2000?listen
and on the client side:
ffmpeg -i tcp://my.vps.ip.address:2000 -c copy video.avi
This way I save the time of downloading, because It starts the download as soon as conversion begins. Then I can seek through in the mjpeg encoded video easily, because every frame is a keyframe, easy to seek back and forth and looking for interesting parts.
konstantin1
8th January 2016, 21:57
Finally I tried another tricky method, using the "scriptfs" program ( https://github.com/frodonh/scriptfs ) It mounts a directory of scripts into another emty dir, and then the mounted directory contains special files, which can be read, but the output is not the real file content, but the result of the script after its running has finished. So I made about 10.000 bash script files, named as 0000001.jpg ... 0010000.jpg, and their content is:
curl -s http://my.vps.ip.address/cgi-bin/stillimage?f=${0/.jpg/}
I put them in a directory "thumb" and I made another directory, called "mirror" and I applied scriptfs on the directories:
scriptfs -p "/usr/bin/sh;always" ./thumb ./mirror
I also made an avisynth script, imagesource.avs:
ImageSource(file = "mirror\%07d.jpg", start = 1, end = 10000, fps = 29.97)
On server side I made a small bash CGI script (named as stillimage), which extracts the specified frame from the video as a jpeg image into a directory "iw", and sends it back to the client immediately. It achieves its purpose by generating an avs script, and then running it by "wine" and "avs2yuv.exe":
#!/usr/bin/sh
f=${QUERY_STRING/f=/}
echo 'loadplugin("ffms2.dll")' > input.avs
echo "ffvideosource(\"video.mp4\").bicubicresize(320,256).converttorgb32().trim($f,$f)" >> input.avs
echo 'ImageWriter("iw/", 0, 0, "jpeg")' >> input.avs
wine avs2yuv input.avs - > /dev/null
echo $'Content-type: image/jpeg\n'
cat iw/000000.jpeg
rm iw/000000.jpeg
Finally on the client PC I can open the imagesource.avs avisynth script with VirtualDub, and I am able to seek through the remote video frames, which are extracted and delivered dinamically, as VirtualDub and avisynth ask for them according to the current script, however the Apache CGI answer is really slow, so this method is even slower then using the TCPdeliver avisynth plugin...
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.