
@dbox-all: Kommt in der nächsten Version mit rein, läuft bei mir derzeit schon als Test. Also immer mit der Ruhe...

Danke Euch beiden !!!BPanther hat geschrieben:@mohousch: Danke für die Info.![]()
@dbox-all: Kommt in der nächsten Version mit rein, läuft bei mir derzeit schon als Test. Also immer mit der Ruhe...
mfgZitat :
Changelog (rev1082->rev4499)
- (rev4499) "TS-Movieplayer" spielt auch andere Formate ab (thx mohousch)
Code: Alles auswählen
sprintf(cmd, "ffmpeg -y -i %s -y -f image2 -ss %d -vframes 1 -s 320*240 %s", fname, spos, (char *)file_name.c_str());
Code: Alles auswählen
sprintf(cmd, "ffmpeg -ss %d -y -i \"%s\" -y -f image2 -vframes 1 -s 320*240 \"%s\"", spos, fname, (char *)file_name.c_str());
Code: Alles auswählen
bool CVCRControl::Screenshot(const t_channel_id channel_id, char * fname, int spos)
{
char filename[512]; // UTF-8
char cmd[512];
std::string channel_name;
CEPGData epgData;
event_id_t epgid = 0;
unsigned int pos;
if(!fname) // live stream
{
char str[256];
struct statfs s;
if (::statfs(g_settings.network_nfs_picturedir, &s) != 0)
{
return false;
}
sprintf(str, "%s/", g_settings.network_nfs_picturedir );
strcpy(filename, str);
pos = strlen(filename);
channel_name = g_Zapit->getChannelName(channel_id);
if (!(channel_name.empty()))
{
strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(channel_name.c_str()));
char * p_act = &(filename[pos]);
do {
p_act += strcspn(p_act, "/ \"%&-\t`'�!,:;");
if (*p_act) {
*p_act++ = '_';
}
} while (*p_act);
strcat(filename, "_");
}
pos = strlen(filename);
if(sectionsd_getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData));
epgid = epgData.eventID;
if(epgid != 0)
{
CShortEPGData epgdata;
if(sectionsd_getEPGidShort(epgid, &epgdata))
{
if (!(epgdata.title.empty()))
{
strcpy(&(filename[pos]), epgdata.title.c_str());
char * p_act = &(filename[pos]);
do {
p_act += strcspn(p_act, "/ \"%&-\t`'~<>!,:;?^�$\\=*#@�|");
if (*p_act) {
*p_act++ = '_';
}
} while (*p_act);
}
}
}
pos = strlen(filename);
time_t t = time(NULL);
strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t));
strcat(filename, ".jpg");
#ifdef __sh__
snprintf(cmd,sizeof(cmd), "ffmpeg -itsoffset -4 -i `wget -q -O - http://127.0.0.1/control/build_live_url --post-data vlc_link=true` -y -f image2 -sn -an -vframes 1 -s 320*240 '%s'", filename);
#else
sprintf(cmd, "grab -v %s", filename);
#endif
}
else
{
//from tsbrowser(MP)
strcpy(filename, fname);
std::string file_name = fname; // UTF-8
int ext_pos = 0;
ext_pos = file_name.rfind('.');
if( ext_pos > 0)
{
std::string extension;
extension = file_name.substr(ext_pos + 1, file_name.length() - ext_pos);
extension = "." + extension;
strReplace(file_name, extension.c_str(), ".jpg");
}
#ifdef __sh__
snprintf(cmd,sizeof(cmd),"ffmpeg -i '%s' 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,// | cut -d ':' -f2",fname);
FILE * f;
int n;
f=popen(cmd, "r");
char buf[256];
while (fgets(buf, 255, f) != NULL)
{
n = int(buf);
printf("%s converted to %d\n", buf, n);
}
pclose(f);
if (n > 3)
snprintf(cmd,sizeof(cmd), "ffmpeg -ss 00:%d:00 -y -i '%s' -y -f image2 -vframes 1 -s 640*360 '%s' 2>&1", spos, fname, (char *)file_name.c_str());
else return false;
#else
sprintf(cmd, "grab -v %s", (char *)file_name.c_str());
#endif
}
printf("Executing %s\n", cmd);
CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, "Screenshot...." );
hintBox->paint();
if(system(cmd)){
hintBox->hide();
delete hintBox;
return false;
}
hintBox->hide();
delete hintBox;
return true;
}
Code: Alles auswählen
bool Screenshot(const t_channel_id channel_id, char * fname = NULL, int spos = 1);
Code: Alles auswählen
else if (msg == CRCInput::RC_record)
{
std::string fname = m_movieSelectionHandler->file.Name;
std::string fname2 = fname;
int ext_pos = 0;
ext_pos = fname.rfind('.');
if( ext_pos > 0)
{
std::string extension;
extension = fname.substr(ext_pos + 1, fname.length() - ext_pos);
extension = "." + extension;
strReplace(fname2, extension.c_str(), ".jpg");
}
if (access(fname2.c_str(), F_OK) != 0)
{
printf("Taking screenshot from %s\n named: %s\n",fname.c_str(),fname2.c_str());
bool retcode = CVCRControl::getInstance()->Screenshot(0, (char *)fname.c_str());
if (retcode) refresh();
}
else
{
if (ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_MOVIEBROWSER_DEL_SS,CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, false) == CMessageBox::mbrYes)
remove(fname2.c_str());
refresh();
}
}
ich hatte den nur drin um die länge gegen die screenshot position zu validieren..was nützt mir ein screenshot bei min 60 wenn die aufnahme nur 30 min lang istBPanther hat geschrieben:und es braucht kein system() mit grep/cut etc. und einem dritten ffmpeg-Aufruf.