Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to set Subtilties in MP4



  • have two srt files (India and English)
    MP4 initially not having subtitles. How to set English subtitles (.srt) to MP4 player.
    Can play subtitles in MP4player but how it can be done in code?

    void MainWindow::video()
    {
        playlist= new QMediaPlaylist();
        player= new QMediaPlayer();
        videoWidget = new QVideoWidget();
    
        playlist->addMedia(QUrl::fromLocalFile("/opt/bird.mp4"));
        playlist->addMedia(QUrl::fromLocalFile("/opt/arrow.mp4"));
    
        playlist->setPlaybackMode(QMediaPlaylist::Loop);
        playlist->setCurrentIndex(1);
        player->setPlaylist(playlist);
        player->setVolume(100);
        player->setVideoOutput(videoWidget);
        playlist->setCurrentIndex(1);
        player->play();
    
    }

Log in to reply