How do I set the interlaced flag on an MKV file so that VLC can automatically play it back deinterlaced? - video-encoding

I've got an MKV file whose source is interlaced NTSC MPEG-2 video. I converted it to H.264 MKV with HandBrake, but this process did not set the "interlaced" flag in the MKV file. The content is interlaced—and I do want it to stay interlaced because it looks much better playing back as 60 fields-per-second content with on-the-fly deinterlacing than it does as 30 frames-per-second content that's been deinterlaced at encode-time.
I tried this...
mkvpropedit -e track:v1 -a interlaced=1 foo.mkv
which did indeed set the interlaced bit...
|+ Segment tracks
| + A track
| + Video track
| + Pixel width: 704
| + Pixel height: 480
| + Display width: 625
| + Display height: 480
| + Interlaced: 1
But when I play the video with VLC with Deinterlace set to Automatic, it doesn't think the video is interlaced and therefore doesn't do the deinterlacing.
What am I doing wrong?
Software versions:
HandBrake 0.9.5
mkvpropedit v5.0.1
Mac OS X 10.7.3

to make handbrake set the interlaced flag:
-use H.264(x264) Video Codec
-at the bottom of the Advanced Tab add :tff or :bff, ( dependant if source is top field first or bottom field first)

I would recommend trying FFMPEG.
Documentation: http://ffmpeg.org/ffmpeg.html
‘-ilme’
Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
Use this option if your input file is interlaced and you want to keep
the interlaced format for minimum losses. The alternative is to
deinterlace the input stream with ‘-deinterlace’, but deinterlacing
introduces losses.
Since you mentioned you are on OSX 10.7 you can use MacPorts to install all dependencies + ffmpeg for you (once the deps are installed you can also build the latest from git).
http://www.macports.org/
(You must be comfortable with the command line for all these tools.)

Related

How to use custom modetimings with NVIDIA on Linux? (In a mult-screen setup)

I am trying out the NREAL Air, and after extensive testing I've found that it is more comfortable for me to use it at the not-edid-available 90 Hz mode. I was able to find this by setting the following parameters in the "screen" section of my xorg conf.
Option "UseEDID" "false"
Option "ModeDebug" "true”
Option "ExactModeTimingsDVI" "true"
Option "ModeValidation" "NoEdidModes, NoMaxPClkCheck, AllowNonEdidModes"
And then appropriately configuring the rest of my xorg.conf. See https://gist.github.com/cnlohr/9375d6fc0097b50f73c4da7b75a20e83
This has the added beneift of you being able to use custom ModeLine with xrandr. Which is awesome, btw!
sudo xrandr --output DP-2 --newmode HS2 200 1920 1952 1968 2000 1080 1089 1094 1250 +hsync +vsync
sudo xrandr --addmode DP-2 HS2
sudo xrandr --output DP-2 --mode HS2
But, this does not work with display managers, like lightdm, which switch into my desired mode, and then immediately switch to the default 1024x768 for both monitors, which my laptop display cannot handle.
It does, however, work with startx but I'd rather not use my system that way, as I like display managers.
Even if I use custom ModeValidation commands, as soon as I don't disable UseEDID the NVIDIA drivers seem to block xrandr from doing any particularly interesting modes, failing with the following error:
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 140 (RANDR)
Minor opcode of failed request: 18 (RRAddOutputMode)
Serial number of failed request: 45
Current serial number in output stream: 46
So, I'm in a bit of a pickle. If I want to use the smoother, less headache-inducing mode for the NREAL AIR, I can't use EDIDs, but what is a life without EDIDs?

Stapling In Postscript File on Ricoh or Keyoceria Or Toshiba Printers

I am writing a postscript file through coding in VB.net and pslibrary. My Main purpose for the job is tray switching from 3 different trays and having stapled the sets based on variable input. i.e I have a post script file of 100 pages first two pages will be simplex and will be printed from two different trays. On third page we will use the third tray and pages from third tray to onward 10 pages will be stapled. After page eleven to next 8 pages will be stapled separately. So it will go so on.
Note: Ricoh Aficio/ Gestatner/ Toshiba Printers is in use 2105-2090 models are being in used.
Tray switching and file is working fine except stapling
Stapling is not working through PS although working fine on machine separately.
Following code is being used to do the work
**{{{
%%Page: 3 3
%%BeginPageSetup
<< /PageSize[595 841] /Duplex false /MediaColor (Red) /Jog 3 /Staple 3 /StapleDetails << /Type 1 /StapleLocation (SinglePortrait) >>>> setpagedevice
save
%%EndPageSetup
(InvoiceNo 50011287697) 72 755.28 /ArialMT 15 SF
%EndPage: 3
restore
showpage
<</PageSize [595 842]/MediaType (Red) /MediaColor (Red) /MediaWeight 75/Duplex false>> setpagedevice
%%Page: 4 4
%%BeginPageSetup
save
%%EndPageSetup
(InvoiceNo 50011287697) 72 755.28 /ArialMT 15 SF
%EndPage: 4
restore
showpage
<< /Jog 0 >> setpagedevice
<< /Staple 0 >> setpagedevice
}}}**
But no stapling is done and printing is started to get out from first paper and that too through its finisher. Printer is just ignoring Staple commands
Things like tray selection and stapling are printer specific. You'll need to extract appropriate code fragments from the .PPD files for the printers in question.
Depending on the exact code fragments needed, it may be possible to combine the fragments into a single PostScript fragment that will work on all of these printers. But it's unlikely to make a fully general solution.
For example, the Ricoh Afficio 2105 PPD file has fragments like this:
<<
/Collate true /CollateDetails <</Type 6 /AlignSet true>>
/Staple 2 /StapleDetails << /Type 14 /Angle 0 /Position 0 >>
>> setpagedevice
The Position changes for different locations but is always a small integer for this printer.
Gestetner 2212 shows fragments that look the same to me as for the Ricoh.
The fragment for a Toshiba 2500C is completely different:
<</TSBPrivate (DSSC PRINT STAPLING=769) >> setpagedevice

Tesseract not able to recognize characters even for a high quality Image

I am doing the process of cleaning up and image using leptonica and then passing it to tesseract for OCR.However it is not able to recognize the characters even though the image is of high quality.The image specifications are as follows.
1 bpp, uncompressed, 1280 * 960 , 300dpi horizontal and vertical resolution
Following are the image processing operations I carry out in sequence using leptonica
pixConvertTo8
pixBackgroundNormSimple
pixOtsuAdaptiveThreshold
pixContrastTRC {Regarding this - I am passing high values like 1.0 or even 5.0 but image doesnt really change}
pixFindSkew
pixRotate { rotate by angle found by pixFindSkew}
pixRotate90 {do this 4 times to read image in all 4 orientations}
pixClipRectangle {crop image}
Finally tesseract command
I get garbage characters in the output.A sample Input Image is as follows.
The output that i get is as follows
Final K-1
II]
s h d | K-1 ,.,
(F°o.~?n‘i&1) 5/>.©12 mm E2‘;
Deparlrnenl of tho Treasury , ,
I 1 I l I
‘mama, Ravenuo SGMW For cnlundm your 201), ‘ " °F°$ "'100fTIO
or lax yum boqmnnnq 7 _ 20\Q_
‘ 7660
and ondmg _ W vv I go
Beneï¬ciary's Share of Income, Deductions,
cl'editS, etc. F 800 buck 01 loam nnd lnstruoflons»
___lnformatI0n About mo Estate or Trust
‘ Ordmary d|v|dm
i 12113
_
‘; Quahfmd dlVIdG
\ 8132
3 1
Net shun-term
A Estate's at trust's omgiuym ldonnlmnluon numbol
56-0987654
B Estate's u trust‘: namo
ESTATE OF MARTHA SMITH
0 Fiduc§ary's name, address, clly, smlu‘ and /IP codo
N01 long~lerm c
\ 24043
u
‘ 28% vale gann
Ti
Unreptumd 5
Omar porfloho 4
nonbuslness lfll
/\..4........ L. ._.._ ,.
What Should i do to improve the accuracy.
Part 2:
I tried to follow this link.And created a eng.user-words.traineddata file and bazaar.train file and tried to run with "bazaar" as additional parameter.but i get "read_params_file: can't open bazaar error".
Any suggestions?
For part one,
I don't know if the image you posted up here is the actual one you've been trying to scan but when I tried it, I got this:-
Department oi the Treasury Internal Revenue Service
For cnlundm your V019, 1 ‘ '"l0T°5' |nC0m0
or tax yam boqlnnlnq , 2o12_ ‘ 7660 and ondlng I go 2: ‘ Ordinary
dlvndm " “T ' x 12113
1; Quali?ed dwnda ‘ 8132 Netshun-term:
M Not long ~terrn c
i 24043 Ab ‘ 2896 ralagann
Bene?ciary’s Share of Income, Deductions, Cfedits, etc. 5 800 back oi
form nnd Instruc?ons
| Partl Information About the state or Trust
A Estate's or IvLsl's omuoym Idonnlncnluon numhu
56-0987654
8 Estate‘: a trust‘: namo
ESTATE OF MARTHA SMITH
M: Unreptumd 5
017161 portioho : nonbuslness Inl
C Fiduc§ary's name, address, city, smlul an-(V1/If’ Eooo
It's not great but it seems a bit better than what you got. I'm using Tesseract v3 on Windows.
My basic command was:
- tesseract.exe nnm.tif nnm
For part two,
your bazaar file should be in the configs folder
.....\Tesseract-OCR\tessdata\configs\bazaar
and there's some requirements for it to be saved in a particular format, like UTF8 with only a LF at the end of the line not a CR + LF, it seems to be quite fussy about the file formats.
you can get a copy of it from http://code.metager.de/source/raw/google/tesseract-ocr/tessdata/configs/bazaar
I made a digits config file that I used for scanning some images where I was only interested in the numbers and that worked fine:
- tesseract.exe scanfile.jpg scanfile digits
The documentation for Tesseract is pretty poor and it doesn't work well on a PC.
For part one,
I think you should consider the preprocessing done by Capture2Text. It is using both Leptonica and Tesseract to OCR the images.
I am not sure about part 2.

How to understand MediaInfo CSV files

There are several CSV files in the Developers/List_Of_Parameters folder, but I'm not sure how to decipher them.
Take the following string for instance:
BitRate/String;;;Y NT;;;Bit rate (with measurement);
I infer that BitRate/String is the exact name of the parameter, and Bit rate (with measurement) provides a description of this parameter. Other than that, I don't know if the blanks in-between have any significance. Also, what does Y NT stand for, and similarly what do the other values in that column mean?
First, I don't know why mediainfo decided to use ".csv" extension on their templates but it isn't a comma-separated values at all, it is a plain/text file and you can use other file extensions as long at it remains a plain/text file, you can use mediainfo CLI to use this templates like this:
mediainfo --Inform="file://template.csv"
A typical template will look like this:
General;Name.........: %FileName%.%FileExtension%\r\nSize.........: %FileSize/String%\r\nDuration.....: %Duration/String3%\r\n
Video;Resolution...: %Width%x%Height%\r\nCodec........: %Codec/String% %Format_Profile%\r\nBitrate......: %BitRate/String%\r\nMax Bitrate..: %BitRate_Maximum/String%\r\nFramerate....: %FrameRate% fps\r\nAspect Ratio.: %DisplayAspectRatio/String%\r\n
Audio;Audio........: %Language/String% %BitRate/String% %BitRate_Mode% %Channel(s)% chnls %Codec/String%\r\n
Text;%Language/String%
Text_Begin;Subs.........:
Text_Middle;,
Text_End;.\r\n
...and will output something like this:
Name.........: My Video.m4v
Size.........: 8.23 GiB
Duration.....: 02:20:02.880
Resolution...: 1920x800
Codec........: AVC High#L3.0
Bitrate......: 7 504 Kbps
Max Bitrate..: 27.1 Mbps
Framerate....: 23.976 fps
Aspect Ratio.: 2.40:1
Audio........: English 448 Kbps CBR 6 chnls AC3
Audio........: Spanish 448 Kbps CBR 6 chnls AC3
Subs.........: English, Spanish.
You can also call mediainfo CLI just to show one parameter:
mediainfo --Inform="General;%Duration%"
MediaInfo definitely lacks of documentation :(, due to lack of time for doing it. on my ToDo-list, but no ETA for it.
Small hints:
Other than that, I don't know if the blanks in-between have any significance.
Check the info_t enum.
Also, what does Y NT stand for, and similarly what do the other values in that column mean?
Check the infooptions_t enum.
Still poor documentation but a bit less poor ;-).
Jérôme, developer of MediaInfo.

how to specify duration in live m3u8 stream using ffmpeg?

I want to specify a duration for example 4 min when using ffmpeg but i keep getting error:
ffmpeg -i "./test.m3u8" -t 04:00 "output.mp4"
and error i get is this:
Invalid duration specification for t: 04:00
also these warnings in yellow color:
max_analyze_duration 5000000 reached at 5014800
Could not find codec parameters (Video: h264 (
Could not find codec parameters (Audio: aac (
Could not find codec parameters (Video: h264 (
Could not find codec parameters (Audio: aac (
hope you guys help me what i am doing wrong. Thanks in advance.
From the documentation:
duration may be a number in seconds, or in hh:mm:ss[.xxx] form.
Your form is mm:ss, so it's simply not valid. Which is also what the error message says.
Use -t 00:04:00 or -t 240 instead.

Resources