Bug 5452 - support for embedded media (e.g. videos and sound)
Summary: support for embedded media (e.g. videos and sound)
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium enhancement
Assignee: poppler-bugs
QA Contact:
URL: http://www.tug.org/tex-archive/macros...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-30 02:13 UTC by Olaf Leidinger
Modified: 2012-05-08 11:16 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Olaf Leidinger 2005-12-30 02:13:53 UTC
Since PDF >= 1.5 files may contain videos or sound but currently they can't be
viewed correctly with free software. Even linux-native adobe reader can't do
this.  Such animations would be nice for PDF-based presentations. 

PDF-files containing videos can be created via pdflatex and the movie15 style.
Please have a look at:

http://www.tug.org/tex-archive/macros/latex/contrib/movie15/
Comment 1 Pablo Rodríguez 2006-04-27 18:24:31 UTC
Would it be so difficult to implement a way so that mplayer could play the
embedded media objects?

More on http://www.tug.org/tex-archive/macros/latex/contrib/movie15/doc/movie15.pdf.

Thanks,


Pablo
Comment 2 Pino Toscano 2007-11-04 04:18:28 UTC
I started to implement sound support in poppler 0.6.
At the moment, only the Qt4 frontend expose the API for reading sounds that should be played as a result of an action (eg a page enter/leave).

No news about movie support, yet.
Comment 3 Pino Toscano 2008-10-05 07:45:37 UTC
Update on the situation.

Sound:
- poppler core and qt4 support them since 0.6
- poppler qt(3) and glib do not support them

Movies:
- poppler core support them since 0.8
- poppler qt4 will ship a basic support for them in 0.10
- poppler qt(3) and glib do not support them
Comment 4 Praveen Thirukonda 2009-11-14 03:16:43 UTC
As there has not been a comment on this bug for about a year. I was wondering if there has been any progress.
This is something that the freedesktop desperately needs. Please fix this.
Comment 5 iloveyoutaiwanmb 2010-05-27 08:03:48 UTC
(In reply to comment #3)
> Update on the situation.
> 
> Sound:
> - poppler core and qt4 support them since 0.6
> - poppler qt(3) and glib do not support them
> 
> Movies:
> - poppler core support them since 0.8
> - poppler qt4 will ship a basic support for them in 0.10
> - poppler qt(3) and glib do not support them

I've tried to grab the SoundObject through Document->Page->Annotations->LinkAnnotation(because the subType is "ALink", but the LinkAnnotation couldn't return a correct Link object, which is always null, and couldn't find the SoundObject therefore.
It seems that no support for sound is in Poppler 0.12.4.
Any suggestions will be welcome!Tks.

Cobra
Comment 6 iloveyoutaiwanmb 2010-05-28 00:04:23 UTC
Thought page->links->linkSound->SoundObject->data, I've retrieved the sound raw data along with channels, BPS, and volume information. But converted by sox into WAV format, it's just noise! Need any conversion or modification before I can use the raw data?
Any suggestion are welcome. Tks.

Cobra
Comment 7 Albert Astals Cid 2010-05-28 12:05:12 UTC
If you attach the file someone maybe will be able to help you better.
Comment 8 iloveyoutaiwanmb 2010-05-29 06:17:38 UTC
    QList<Poppler::Link*> pageLinks = doc->page(currentPage)->links();
    if (pageLinks.isEmpty()){
        QLabel *msgLabel = new QLabel(tr("No L's"));
        msgLabel->setVisible(true);
    }
    else{      
        //QLabel *msgLabel = new QLabel(tr("W L's"));
        //msgLabel->setVisible(true);
        int linkCount = pageLinks.count();
        QString outStr;
        foreach (Poppler::Link* link, pageLinks){
            bool firstMP3 = true;
            if (link==0){
                ;
            }
            if ( link != 0  ){
                switch  (link->linkType()){
                case Poppler::Link::Sound:{
                    outStr.append( "Sound" );
                    void *linktmp = (void*) link;
                    Poppler::LinkSound* ls = (Poppler::LinkSound *)(linktmp);
                    Poppler::SoundObject *so = ls->sound();
                    double volume = ls->volume();
                    QRectF linkArea = ls->linkArea();
                    bool mix = ls->mix();
                    if ( so->soundType() == Poppler::SoundObject::Embedded ){
                        if ( so->data().size() > 0 ){
                            QByteArray soByteArray(so->data());
                            int balen = soByteArray.size();
                            Poppler::SoundObject::SoundEncoding se = so->soundEncoding();
                            double samplingRate = so->samplingRate();
                            int channels = so->channels();
                            int bitsPerSample = so->bitsPerSample();

                            QFile destFile("./test.raw");
                            destFile.open(QIODevice::WriteOnly);
                            destFile.write(soByteArray.data(), soByteArray.size());

                            if ( firstMP3==true ){
                                firstMP3 = false;
                                /*
                                QWidget *widget = new QWidget;
                                widget->setWindowTitle("Video Player");
                                widget->resize(400,400);
                                widget->show();

                                Phonon::VideoPlayer *player = new Phonon::VideoPlayer(Phonon::VideoCategory, this);

                                player->load(Phonon::MediaSource(soByteArray));
                                player->play();
                                */
                            }
                            else{

                            }
                        }
                        else{

                        }
                    }
                    break;
                }

-------------
I've saved the RAW data into a file "./test.raw". Then, the file was transformed into WAV format by SOX. But, after all, it's full of noise!

Cobra
Comment 9 iloveyoutaiwanmb 2010-06-04 00:18:40 UTC
(In reply to comment #8)

I've compared the retrived QByteArray with the original audio file (.aiff), and finally gotten the point. Now, my question turns out to how we could find out what format it is? I mean, although we could get the bits per sample, channel number, and sampling rate, there is no obvious way to know the exact file format, i.e, WAV, AIFF, and even MP3.

Cobra
Comment 10 oliver.sander 2012-05-06 08:19:18 UTC
As of poppler 0.20, pdfs with videos created by pdflatex and the movie15 package are now shown by okular.  There are various minor glitches, but they should better be dealt with in separate bug reports.  The basic functionality is there.
Comment 11 Albert Astals Cid 2012-05-08 11:16:52 UTC
Agreed with sander, please file smaller and more concise bug reports so we can tackle them better and in a more focused way


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.