seek

How can I seek to frame No. X with ffmpeg?

放肆的年华 提交于 2019-11-30 04:48:27
I'm writing a video editor , and I need to seek to exact frame, knowing the frame number . Other posts on stackoverflow told me that ffmpeg may give me a few broken frames after seeking, which is not a problem for playback but a big problem for video editors. And I need to seek by frame number , not by time, which will become inaccurate when converted to frame number. I've read dranger's tuts (which is outdated now), and end up with: av_seek_frame(fmt_ctx, video_stream_id, frame, AVSEEK_FLAG_ANY); It always seek to frame No. 0 , and always return 0 which means success. Then I tried to read

Android SeekBar to control MediaPlayer progress

北战南征 提交于 2019-11-30 00:11:52
I have a SeekBar , it displays correctly MediaPlayer progress. However, I have troubles with seeking - if I seek scroll box somewhere it just returns on the position where audio file is playing. public class EntityPageActivity extends Activity implements Runnable, OnClickListener, OnSeekBarChangeListener{ private SeekBar seekBar; private Button startMedia; private Button pauseMedia; private MediaPlayer mp; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.entity_page); AudioControl(); } public void AudioControl(){ seekBar =

Perl seek function

此生再无相见时 提交于 2019-11-29 21:16:46
问题 This problem was solved. Thank you very much. My question and the solution I am using is stated below. Question: open IN, "<./test.txt"; seek(IN,10,0); read IN, $temp, 5; seek(IN,20,0); close(IN); The situation is that, my handle will start at position 0. After the first seek function, my file handle will at position 10. After I read, my handle will at position 15. At this moment, I seek again. Then the program will seek from the beginning or from position 20. My question is that is there

OpenCV Seek Function/Rewind

╄→尐↘猪︶ㄣ 提交于 2019-11-29 16:23:26
问题 I've been trying to find/implement a seek and rewind function (for video (.avi)) using OpenCV in C++, but I cant find a way of doing it, other than going through the entire file once and saving each image. Is there any other way? Any help would be much appreciated; Thanks ahead of time! 回答1: Using cvSetCaptureProperty() you can cycle through frames, either in miliseconds or by ordinal frame number. int cvSetCaptureProperty( CvCapture* capture, int property_id, double value ); property_id is a

Python: rewinding one line in file when iterating with f.next()

三世轮回 提交于 2019-11-29 13:40:05
Python's f.tell doesn't work as I expected when you iterate over a file with f.next(): >>> f=open(".bash_profile", "r") >>> f.tell() 0 >>> f.next() "alias rm='rm -i'\n" >>> f.tell() 397 >>> f.next() "alias cp='cp -i'\n" >>> f.tell() 397 >>> f.next() "alias mv='mv -i'\n" >>> f.tell() 397 Looks like it gives you the position of the buffer rather than the position of what you just got with next(). I've previously used the seek/tell trick to rewind one line when iterating over a file with readline(). Is there a way to rewind one line when using next()? Omnifarious No. I would make an adapter that

Using FileStream.Seek

一曲冷凌霜 提交于 2019-11-29 12:24:52
I am trying to work with FileStream.Seek to quickly jump to a line and read it. However, I am not getting the right results. I have tried to look at this for a while and can't understand what I am doing wrong. Environment: OS: Windows 7 Framework: .NET 4.0 IDE: Visual C# Express 2010 Sample Data in file location: C:\Temp\Temp.txt 0001|100!2500 0002|100!2500 0003|100!2500 0004|100!2500 0005|100!2500 0006|100!2500 0007|100!2500 0008|100!2500 0009|100!2500 0010|100!2500 The code: class PaddedFileSearch { private int LineLength { get; set; } private string FileName { get; set; } public

How to write at a particular position in text file without erasing original contents?

末鹿安然 提交于 2019-11-29 11:38:57
I've written a code in Python that goes through the file, extracts all numbers, adds them up. I have to now write the 'total' (an integer) at a particular spot in the file that says something something something...Total: __00__ something something . I have to write the total that I have calculated exactly after the Total: __ part which would mean the resulting line would change to, for example: something something something...Total: __35__ something something . So far I have this for the write part: import re f1 = open("filename.txt", 'r+') for line in f1: if '__' in line and 'Total:' in line:

seek() a file within a zip file in Python without passing it to memory

早过忘川 提交于 2019-11-29 04:13:35
is there anyway to make a file inside a zip file seekable in Python without reading it to memory? I tried the obvious procedure but I get an error since the file is not seekable: In [74]: inputZipFile = zipfile.ZipFile("linear_g_LAN2A_F_3keV_1MeV_30_small.zip", 'r') In [76]: inputCSVFile = inputZipFile.open(inputZipFile.namelist()[0], 'r') In [77]: inputCSVFile Out[77]: <zipfile.ZipExtFile at 0x102f5fad0> In [78]: inputCSVFile.se inputCSVFile.seek inputCSVFile.seekable In [78]: inputCSVFile.seek(0) --------------------------------------------------------------------------- UnsupportedOperation

seek to a point in html5 video

╄→гoц情女王★ 提交于 2019-11-29 02:51:56
Is it possible to seek to a particular point in html5 video displayed in a web page? I mean ,can I input a particular time value (say 01:20:30:045 ) and have the player control (slider) move to that point and play from that point onwards? In older version of mozilla vlcplugin I think this is possible by seek(seconds,is_relative) method..but I would like to know if this is possible in html video. Edit: I created the page with video and added javascript as below.When I click on the link ,it displays the time of click..but it doesn't increment the play location..but continues to play normally.

How to delete only the content of file in python

心不动则不痛 提交于 2019-11-28 18:12:45
I have a temporary file with some content and a python script generating some output to this file. I want this to repeat N times, so I need to reuse that file (actually array of files). I'm deleting the whole content, so the temp file will be empty in the next cycle. For deleting content I use this code: def deleteContent(pfile): pfile.seek(0) pfile.truncate() pfile.seek(0) # I believe this seek is redundant return pfile tempFile=deleteContent(tempFile) My question is: Is there any other (better, shorter or safer) way to delete the whole content without actually deleting the temp file from