You are not logged in.

#26 2010-02-03 07:30:14

Ape
Member
From: Finland
Registered: 2009-10-15
Posts: 46
Website

Re: x264 Lossless Screencast Script

I installed ffcast from AUR and tried to run it, but it just gives me files with size smaller than 500 KB and which doesn't play at all on my VLC. I upgraded to ffmpeg-svn and x264-git, but got the same results with those.

ape ~$ ffcast -a -t 5
==>  Fullscreen capture
  ->  Selecting root of 1 window(s)
==>  Capture geometry: 1680x1050+0+0
==>  Capture duration limited to [00:00:05.00]
==>  Capture started, press [q] to finish
==>  Output filename: ffcast.100203092751.mkv

Offline

#27 2010-02-03 08:09:34

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,676

Re: x264 Lossless Screencast Script

Hi, all.

robmaloy wrote:

... ...
ffmpeg -r 15 -v 1 -s 296x142 -an -f x11grab -i :0.0+505,382 -vcodec libx264 \
-vpre main -vpre lossless_slow -crf 0 -f h264  -sameq "ffcast.100202213056.mkv"
... ...
:0.0+505,382: no such file or directory

Looks like a funny bug in ffmpeg. The command line works for me.
Try updating your ffmpeg package. The latest in extra is "built on Jan 31 2010 04:14:13 with gcc 4.4.3".

DrZaius wrote:

The -vpre lossless_slow option enables the options that -vpre main disables, and since the order of presets matters, -vpre main is essentially being ignored.

Yeah, you're right. -vpre main seems useless with the hard-coded fallback preset being 'lossless_slow'. But it doesn't hurt, either. wink

DrZaius wrote:

Also, you should re-enable -threads 0 for libx264.

Any particular reason/stats? If it's really useful, I'll add it back for the x264 encoding.

GogglesGuy wrote:

This works very nice! Thanks!

Thanks smile

Ape wrote:

it just gives me files with size smaller than 500 KB

<500 KB looks right, since you captured only 5 seconds.

Ape wrote:

and which doesn't play at all on my VLC

I can play it with `mplayer -noconfig all ffcast.mkv'; all of my mplayer, ffmpeg, x264 are from extra. Maybe try mplayer, or adjust the VLC command line?

Best Regards.


This silver ladybug at line 28...

Offline

#28 2010-02-03 15:23:18

Ape
Member
From: Finland
Registered: 2009-10-15
Posts: 46
Website

Re: x264 Lossless Screencast Script

lolilolicon wrote:
Ape wrote:

and which doesn't play at all on my VLC

I can play it with `mplayer -noconfig all ffcast.mkv'; all of my mplayer, ffmpeg, x264 are from extra. Maybe try mplayer, or adjust the VLC command line?

It works with mplayer. I can play other mkv/h264 files with my VLC successfully. VLC outputs this:

VLC media player 1.0.5 Goldeneye
[0x247e238] ts demux warning: TS module discarded (lost sync)
[h264 @ 0x7fa43c017110]max_analyze_duration reached
[h264 @ 0x7fa43c017110]Estimating duration from bitrate, this may be inaccurate
missing picture in access unit
[0x7fa43c005038] main decoder warning: can't get output picture

Offline

#29 2010-02-03 16:09:43

GogglesGuy
Member
From: Rocket City
Registered: 2005-03-29
Posts: 603
Website

Re: x264 Lossless Screencast Script

It would be nice to be able start and stop ffcast from a shortcut key or button on a panel. Anyone has a recipe for that?

Offline

#30 2010-02-03 21:43:33

DrZaius
Member
Registered: 2008-01-02
Posts: 165

Re: x264 Lossless Screencast Script

lolilolicon wrote:
DrZaius wrote:

Also, you should re-enable -threads 0 for libx264.

Any particular reason/stats? If it's really useful, I'll add it back for the x264 encoding.

With my limited hardware (P4 3 GHz) using the following FFmpeg command I get about 10 fps:

ffmpeg -r ntsc -s 640x480 -an -f x11grab -i :0.0+48,38 -vcodec libx264 -vpre lossless_slow nothreads.mkv

With threads, I get about 12 fps:

ffmpeg -r ntsc -s 640x480 -an -f x11grab -i :0.0+48,38 -vcodec libx264 -vpre lossless_slow -threads 0 threads.mkv

Not a big difference, but it is measurable.  However, I will guess that the difference may be much greater using more modern hardware, especially when capturing fullscreen.  I will hopefully test this theory later today on my coworkers new i7 860.

Last edited by DrZaius (2010-02-03 22:09:48)


Damned dirty ape.

Offline

#31 2010-02-03 22:07:47

DrZaius
Member
Registered: 2008-01-02
Posts: 165

Re: x264 Lossless Screencast Script

Also, -crf 0 isn't doing anything.  You don't need to declare a crf value when using a lossless preset:

$ ffmpeg -t 10 -i input.avi -an -vcodec libx264 -vpre lossless_slow -crf 0 crf.mkv
$ ffmpeg -t 10 -i input.avi -an -vcodec libx264 -vpre lossless_slow nocrf.mkv
$ md5sum crf.mkv crf2.mkv 
0cd92bafbcc19845b825fc4647d197ce  crf.mkv
0cd92bafbcc19845b825fc4647d197ce  crf2.mkv

Another non-used option when using libx264 lossless is -sameq.  It's simply being ignored.

Last edited by DrZaius (2010-02-03 22:08:18)


Damned dirty ape.

Offline

#32 2010-02-04 12:06:09

Themaister
Member
From: Horten, Norway
Registered: 2008-07-21
Posts: 647
Website

Re: x264 Lossless Screencast Script

Isn't it more "clean" to let x264 itself take care of the encoding? I've had several problems with ffmpeg libx264. E.g. corrupted h264 video for some reason. Generally, I don't like encoding x264 with ffmpeg at all. -f yuv4mpegpipe is great though big_smile
Overall, I liked the idea of ffcast though, so I tweaked it a bit.

ffmpeg -r 30 -s $SIZE -an -f x11grab -i :0.0+$SIZE2 -pix_fmt yuv420p -f yuv4mpegpipe - 2>/dev/null | x264 - --crf 23 --preset veryfast --stdin y4m -o /tmp/temp.mkv
mkvmerge /tmp/temp.mkv -o /tmp/cap.mkv &> /dev/null # Remuxing to be safe.
rm /tmp/temp.mkv

Offline

#33 2010-02-04 19:47:06

DrZaius
Member
Registered: 2008-01-02
Posts: 165

Re: x264 Lossless Screencast Script

Themaister wrote:

Isn't it more "clean" to let x264 itself take care of the encoding? I've had several problems with ffmpeg libx264. E.g. corrupted h264 video for some reason. Generally, I don't like encoding x264 with ffmpeg at all.
...

I use -f yuv4mpegpipe and x264 occasionally, but I've never had libx264 create corrupt outputs.  Is this reproducible?  FFmpeg and x264 development is active and I'm sure they would appreciate knowing that your outputs don't always work.


Damned dirty ape.

Offline

#34 2010-02-04 22:05:33

Themaister
Member
From: Horten, Norway
Registered: 2008-07-21
Posts: 647
Website

Re: x264 Lossless Screencast Script

It's very simple to reproduce for me at least. Well, the video is probably not broken. However, this only happens with vdpau output (completely garbage picture). (works with -vo vdpau -vc ffh264 though) :x I can upload a sample that's broken for me here.
Piping the video through -f yuv4mpegpipe works flawlessly though. With -vc ffh264vdpau and whatnot.
http://maister.homelinux.org/downloads/ … 230111.mkv (24 kB big_smile)

Last edited by Themaister (2010-02-04 22:06:21)

Offline

#35 2010-02-05 00:42:25

DrZaius
Member
Registered: 2008-01-02
Posts: 165

Re: x264 Lossless Screencast Script

robmaloy wrote:

hi, i get the following error (doesn't matter if with "-s" or not)

$ ffcast -s --debug
(DD)  Checking display :0.0 with `xrectsel :0.0 checkdpy'
xrectsel: Valid display_name :0.0
(DD)  VCODEC: -vcodec libx264 -vpre main -vpre lossless_slow -crf 0
(DD)  FORMAT: -f h264
(DD)  geometry: root: 1680x1050
==>  Select screen area to be captured by mouse drag
  ->  Drag mouse with button one pressed
  ->  Press any key on keyboard to abort
(DD)  geometry: mod 2: 296x142
(DD)  geometry: in screen:296x142+505+382
==>  Capture geometry: 296x142+505+382
(DD)  ffmpeg: command line:
ffmpeg -r 15 -v 1 -s 296x142 -an -f x11grab -i :0.0+505,382 -vcodec libx264 \
-vpre main -vpre lossless_slow -crf 0 -f h264  -sameq "ffcast.100202213056.mkv"
==>  Capture started, press [q] to finish
FFmpeg version UNKNOWN, Copyright (c) 2000-2010 Fabrice Bellard, et al.
  built on Jan 10 2010 17:47:18 with gcc 4.4.2 20091208 (prerelease)
  configuration: --prefix=/usr --enable-gpl --enable-libmp3lame --enable-libvorbis \
--enable-libfaac --enable-libfaad --enable-libxvid --enable-libx264 --enable-libtheora \
--enable-postproc --enable-shared --enable-pthreads --enable-x11grab \
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-version3 --enable-nonfree
  libavutil     50. 7. 0 / 50. 7. 0
  libavcodec    52.45. 0 / 52.45. 0
  libavformat   52.46. 0 / 52.46. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 8. 0 /  0. 8. 0
  libpostproc   51. 2. 0 / 51. 2. 0
:0.0+505,382: no such file or directory

edit: inserted some line breaks

I got the same error on an Ubuntu machine when I compiled FFmpeg SVN without the x11proto-fixes-dev package (libxfixes in Arch).


Damned dirty ape.

Offline

#36 2010-02-20 15:00:02

quantumphaze
Member
From: Melbourne, Australia
Registered: 2008-11-14
Posts: 169

Re: x264 Lossless Screencast Script

Wow, this idea has come very far since I made the first reply. Congratulations.

When I make a file with the default options it plays back really fast. Any idea on how to fix that. I think it's not putting the recorded fps in the container and mplayer just uses it's default (I assume it's over 30)


▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▏▎▍▌▋▊▉█▇▆▅▄▃▂▁

Offline

#37 2010-02-21 16:21:27

Emess
Member
From: Tokyo, Japan
Registered: 2008-01-20
Posts: 21

Re: x264 Lossless Screencast Script

quantumphaze wrote:

Wow, this idea has come very far since I made the first reply. Congratulations.

When I make a file with the default options it plays back really fast. Any idea on how to fix that. I think it's not putting the recorded fps in the container and mplayer just uses it's default (I assume it's over 30)

Default x264 framerate, and also mkvmerge, is 25fps. I have no idea what ffmpeg uses seeing as I prefer to use x264 directly (hurr patches) but I'd assume the same.

Anyone tested this on high-res screencasting, say 1920x1200 at 24/1.001fps? I'm needing to do some video tutorials about intensive video editing and encoding and I'm going to require capping at that res and framerate for editing with.

E~

Offline

Board footer

Powered by FluxBB