I am starting to learn about ffmpeg and there is an unknown problem so use atrim=a:b or aselect='between(t, a,b)' when you want to trim an audio.
What is the difference between them?
atrim=a:b will select starting with timestamp a but drop frames with timestamp b or greater.
aselect='between(t,a,b)' will select starting with timestamp a; it will select frame with timestamp b but drop all frames with a timestamp greater than b.
Other than that, they are similar. Timestamps of selected frames will not be reset to start with 0 in either filter.
Related
Hi I need to convert fixed format code to Free format as per my companies coding standard instructions. I dont even understand what the below means except that some date movement and conversions are happening..
C *ISO MOVE BCEXDT MDYDATE
C MOVE MDYDATE PEXPDATT
C *ISO MOVE BCSTDT MDYDATE
C MOVE MDYDATE PSTRDAT
Field definitions below:
BCEXDT 8S 0
BCSTDT 8S 0
D MDYDATE S D DATFMT(*MDY)
The two move operations for which you have shown the definitions can be converted like this:
C *ISO MOVE BCEXDT MDYDATE
C *ISO MOVE BCSTDT MDYDATE
to
MDYDate = %date(bcexdt: *ISO);
MDYDate = %date(bcstdt: *ISO);
Note that MDYDate is a date field, and has the same internal format as every other date field. The DATFMT(*MDY) keyword only defines how the field is represented externally by default when loaded into (or from) a character or numeric field. It also sets limits on allowable values. In the case of *MDY, those limits are 01-01-1940 to 12-31-2039. Notice that the values in BCEXDT and BCSTDT are *ISO format, and the values limits are different for those fields. Specifically 0001-01-01 to 9999-12-31. So you could get errors when attempting to assign the *ISO date to a *MDY date field.
The two moves I haven't converted for you would be done in one of the following ways.
If the targets are date fields:
pexpdatt = MDYDate;
pstrdat = MDYDate;
If the targets are numeric fields:
pexpdatt = %dec(MDYDate);
pstrdat = %dec(MDYDate);
If the targets are character fields:
pexpdatt = %char(MDYDate);
pstrdat = %char(MDYDate);
%dec() and %char() will assign the date fields in *MDY format since it was not explicitly specified in the assignment, and the date fields have DATFMT(*MDY).
Nobody else is going to be able to tell you what is going on either; without the definitions of the source and target fields.
That's why IBM depreciated the MOVE op-code from free-form.
I have time data from the unix time command like
203m53.5s
I have this data in excel. I want it to be converted to Excell time format so I can do mathematical operations like sum and averages over them.
How can I do this
Replace the m with : and the s with "":
=--SUBSTITUTE(SUBSTITUTE(A1,"m",":"),"s","")
Now that the time is in a format that Excel will recognize we need to change it from string text to a number. The -- is forcing the string into a number by performing a mathematical process of multiplying -1 * -1 to it.
It can be replaced by TIMEVALUE()
Then format the cell with a custom format of:
[mm]:ss.0
One way is to use a forumala to strip out the m and s and use those values for time in a new column in Excel.
Assume the Unix data is in column A.
=(LEFT($A1,FIND("m",$A1)-1)*60+MID($A1,FIND("m",$A1)+1, LEN($A1)-FIND("m",$A1)-1)/84600
then format the cell as custom and choose the time without the AM/PM
Breakdown:
(get the minutes by finding "m")
multiply by 60 to convert to seconds
+ (get the seconds by starting at the location of m, +1 to the location of m-length of the whole string)
-1 to account for the actual "s"
Then divide the whole thing by 84600 to convert to time as a decimal
I have data of 100 x 101. I want to convert them in series e.g. for first row all column data then for 2nd row all column data and so on. It means the result will be three columns only. The first column with row numbers, the 2nd column with column numbers and the 3rd column with the value for that respective row and column.
Could you please help me doing this conversion in MATLAB.
Available data are in ASCII format and it is possible to open in both MATLAB and Excel.
This can be done by find:
A = rand(100,101);
[data(:,1), data(:,2), data(:,3)] = find(A);
data = sortrows(data,[1 2]);
Note that this is highly inefficient, as you are storing 3 values where you only need to store 1 (the element's actual value). For accessing a specific element, say row 31, column 43, you simply do A(31,43), where you index the matrix.
The file size of data is indeed three times larger than that of A:
whos
Name Size Bytes Class Attributes
A 100x101 80800 double
data 10100x3 242400 double
You can use the ind2sub function that is faster and make more sense in this situation:
tic
A = rand(100,101);
[data(:,1), data(:,2), data(:,3)] = find(A);
data = sortrows(data,[1 2]);
toc
tic
B = A' ;
[data_B(:,1), data_B(:,2)] = ind2sub(size(B), 1:length(B(:)));
data_B(:,3) = B(:);
toc
The output for the timing is as follow:
Elapsed time is 0.002130 seconds (first method)
Elapsed time is 0.000525 seconds (second method).
I have a incoming file like (in.txt) which is a Tab Separated File and NO Header line in it.
I want to duplicated each row TWO times and do the replacement (base on the rules).
I am new in *nux, i am totally no idea what tools can help me to do this.
The Incoming file (in.txt. Separated by Tab(\t))
A B C D E F G H
1 855211046 2/3/2015 $170.00 4154245328852953 328573 1809 CC786875287728777
2 855211046 3/3/2015 $100.10 5524415875875844 822409 1809 CC150330106885244
3 855211046 30/3/2015 $105.00 4875875852875211 445092 1809 CC456387885245062
etc.
The Expected Outcome (Outcome.txt)
^2.{32}(855211046000).{8}(150302)
^5(855211046000).{7}(4154245328852953 ).{60}(150302)(328573).{10}\s{1}(000000017000)
^5(855211046000).{7}(4154245328852953 ).{60}(150302)(328573).{122}(000000017000)
^2.{32}(855211046000).{8}(150303)
^5(855211046000).{7}(5524415875875844 ).{60}(150303)(822409).{10}\s{1}(000000010010)
^5(855211046000).{7}(5524415875875844 ).{60}(150303)(822409).{122}(000000010010)
^2.{32}(855211046000).{8}(150330)
^5(855211046000).{7}(4875875852875211 ).{60}(150330)(445092).{10}\s{1}(000000010500)
^5(855211046000).{7}(4875875852875211 ).{60}(150330)(445092).{122}(000000010500)
Rules
*1st record*
^2.{9}.{7}.{16}([Column B's data, 0 fill right till the position 12]).{8}([Column C's data but reformat to YYMMDD format])
^5([Column B's data, 0 fill right till the position 18]).{7}([Column E's data, SPACE fill right till the position 19]).{60}([Column C's data but reformat to YYMMDD format])([Column F's data]).{10}\s{1}([Column D's data but remove $ sign and then multiplied by 100])
^5([Column B's data, 0 fill right till the position 18]).{7}([Column E's data, SPACE fill right till the position 19]).{60}([Column C's data but reformat to YYMMDD format])([Column F's data]).{122}([Column D's data but remove $ sign and then multiplied by 100])
*2nd record*
same as 1st
*3rd record*
same as 1st
Thanks a lot.
It is not difficult but require attention and some typewriting:
awk '
/./{
split($3,T,"/")
$3=sprintf("%d%02d%02d",T[3]-2000,T[2],T[1])
sub("\\$","",$4);$4*=100
printf "^2.{9}.{7}.{16}(%d%0."12-length($2)"d).{8}(%d)\n",$2,0,$3
printf "^5(%d%0."18-length($2)"d).{7}(%-19d).{60}(%d)(%d).{10}\\s{1}(%012d)\n",$2,0,$5,$3,$6,$4
...
}' in.txt >Outcome.txt
I am sure that you easyly add printf for 3rd line output according to above example.
I want to know how to do
digit grouping
when I have value for money for example 3000000 ( 3million) i want to print 3.000.000 on the screen (there is a dot every three character from the last character)
Remove zeroes in front of value
when I select a value from table and print it on the screen, the value get padded with zeroes automatically: e.g. 129 becomes 0000129
The WRITE statement allows you to specify a currency. Example:
DATA price TYPE p DECIMALS 2.
price = '3000000'.
WRITE: / price CURRENCY 'USD'.
Note that this does not interpret the number itself, but just adds commas and dots at certain positions depending on the currency you specify. So in the event you have an integer with the value of 3000000 and you write it with currency USD the result will be 30.000,00.
I suggest you read the F1 help information on the WRITE statement, because there are a lot more options besides this one.
--
Removing leading zeroes is done by using a conversion routine.
The CONVERSION_EXIT_ALPHA_INPUT will add leading zeroes and CONVERSION_EXIT_ALPHA_OUTPUT will remove them.
It is possible to add these routines to a Domain in the dictionary, so the conversion will be done automatically. For example the MATNR type:
DATA matnr TYPE matnr.
matnr = '0000129'.
WRITE: / matnr.
This will output 129 because the Domain MATNR has a conversion routine specified.
In the case of a type which does not have this, for example:
DATA value(7) TYPE n.
value = '0000129'.
WRITE: / value.
The output will be 0000129. You can call the CONVERSION_EXIT_ALPHA_OUTPUT routine to achieve the output without leading zeroes:
DATA value(7) TYPE n.
value = '0000129'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = value
IMPORTING
output = value.
WRITE: / value.
Please also note that output conversion for numberlike types - triggered by the WRITE statement - is controlled by a property in the user master data.
Decimal separator and digit grouping should be configured there.
You could check this in the user master transactions e.g. SU01 or SU01D.
For removing the zero padding use NO-ZERO statement. For the thousand separator I do not see any problem because it is a standard way ABAP prints values of type P. Here is a sample code.
REPORT ZZZ.
DATA:
g_n TYPE n LENGTH 10 VALUE '129',
g_p TYPE p LENGTH 12 DECIMALS 2 VALUE '3000000'.
START-OF-SELECTION.
WRITE /: g_n, g_p.
WRITE /: g_n NO-ZERO, g_p.
This produces the output.
000000129
3.000.000,00
129
3.000.000,00
For removing leading zeros, you can do the following:
data: lv_n type n length 10 value '129'.
shift lv_n left deleting leading '0'.