New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPEG gets played as MP3 #3973

Closed
rr- opened this Issue Jan 1, 2017 · 8 comments

Comments

Projects
None yet
7 participants
@rr-
Member

rr- commented Jan 1, 2017

mpv version and platform

mpv git-0067d1dbe (C) 2000-2016 mpv/MPlayer/mplayer2 projects
 built on Sun Jan  1 11:58:48 CET 2017
ffmpeg library versions:
   libavutil       55.43.100
   libavcodec      57.70.100
   libavformat     57.61.100
   libswscale      4.3.101
   libavfilter     6.68.100
   libswresample   2.4.100
ffmpeg version: N-82927-gc6c888e996

Sample files

https://0x0.st/pVG.jpg (slighly NSFW but it's the only sample I had)

Reproduction steps

mpv 1468861116228.jpg --loop=yes

Expected behavior

I should see a muscular girl in the JPEG file

Actual behavior

I hear industrial music instead

Workaround

Passing --demuxer-lavf-hacks=no seems to mitigate the issue (as pointed out by tyng on IRC).

Log file

mpv 1468861116228.jpg --msg-level=ffmpeg=debug
Playing: 1468861116228.jpg
[ffmpeg] Probing jpeg_pipe score:6 size:2048
[ffmpeg] Probing jpeg_pipe score:6 size:4096
[ffmpeg] Probing jpeg_pipe score:6 size:8192
[ffmpeg] Probing jpeg_pipe score:6 size:16384
[ffmpeg] Probing jpeg_pipe score:6 size:32768
[ffmpeg] Probing jpeg_pipe score:6 size:65536
[ffmpeg] Probing mp3 score:25 size:98304
[ffmpeg] Probing mp3 score:25 size:98304
[ffmpeg/demuxer] mp3: Before avformat_find_stream_info() pos: 0 bytes read:1073905792 seeks:65543 nb_streams:1
[ffmpeg/audio] mp3: Header missing
[ffmpeg/audio] mp3: Header missing
[ffmpeg/audio] mp3: Header missing
[ffmpeg/audio] mp3: Header missing
[ffmpeg/audio] mp3: Header missing
[ffmpeg/audio] mp3: Header missing
[ffmpeg/audio] mp3: Header missing
[ffmpeg/demuxer] mp3: Estimating duration from bitrate, this may be inaccurate
[ffmpeg/demuxer] mp3: stream 0: start_time: 0.000 duration: 3.072
[ffmpeg/demuxer] mp3: format: start_time: 0.000 duration: 3.072 bitrate=256 kb/s
[ffmpeg/demuxer] mp3: After avformat_find_stream_info() pos: 98304 bytes read:1074004096 seeks:65543 frames:34
 (+) Audio --aid=1 (mp3)
[ffmpeg/audio] mp3: Header missing
Error decoding audio.
[ffmpeg/audio] mp3: Header missing
Error decoding audio.
[ffmpeg/audio] mp3: Header missing
Error decoding audio.
[ffmpeg/audio] mp3: Header missing
Error decoding audio.
[ffmpeg/audio] mp3: Header missing
Error decoding audio.
[ffmpeg/audio] mp3: Header missing
Error decoding audio.
[ffmpeg/audio] mp3: Header missing
Error decoding audio.
AO: [alsa] 48000Hz stereo 2ch s16
[ffmpeg] SWR: Using s16p internally between filters
[ffmpeg] SWR: Using s16p internally between filters
A: 00:00:00 / 00:00:03 (7%) Cache:  0s+0KB
[ffmpeg/audio] mp3: overread, skip -6 enddists: -5 -5
A: 00:00:00 / 00:00:03 (13%) Cache:  0s+0KB
[ffmpeg/audio] mp3: overread, skip -6 enddists: -5 -5
A: 00:00:00 / 00:00:03 (21%) Cache:  0s+0KB
Exiting... (End of file)
@Al-eXs

This comment has been minimized.

Al-eXs commented Jan 4, 2017

For some reason, that file IS both, a JPEG and MP3.

That could be done in windows with something like this: copy /b someimage.jpg+someaudio.mp3 newimage.jpg and that plays directly in MPV as the MP3.

In linux is something like: cat someimage.jpg someaudio.mp3 > newimage.jpg. (I extracted the audio from that file and merged into another image to test, the same error log in the MPV)

It's rather unusual to discover that kind of files, but it's one way of "hide" files.

@cehoyos

This comment has been minimized.

cehoyos commented Jan 4, 2017

I thought the file was created by cutting the beginning of an mp3 containing cover art...

@Jj0YzL5nvJ

This comment has been minimized.

Jj0YzL5nvJ commented Jan 5, 2017

Very unusual file, I don't see the mp3 header anywhere.
If you only want the image, this does the trick:
dd if=/tmp/pVG.jpg of=/tmp/solo.jpg bs=69812 count=1

@lachs0r

This comment has been minimized.

Member

lachs0r commented Jan 5, 2017

mp3 has no header, that’s the joke (and why ffmpeg and other software is so bad at detecting mp3 when there’s no id3 tag).

@wm4

This comment has been minimized.

Contributor

wm4 commented Jan 6, 2017

  1. ffmpeg doesn't use the id3 tag to detect whether it's mp3 or not, because id3 can be used with other formats (like matroska), and ffmpeg supports this of course
  2. an id3 tag is actually more likely to reduce the chance of detection: it's not skipped by the prober (I think), and it can be large, giving less real data to the prober
  3. of course mp3 has some sort of header, just that it's not the kind of header that makes detection possible. however, if you see a bunch of very similar mp3 headers in a row with no garbage data between it, it's very likely that it's a real mp3 file

The main problem is IMHO that the ffmpeg mp3 prober is of bad quality full of nonsensical heuristics (instead of using heuristics that would hunt for "useful" features). It even detects ELF binaries as mp3.

@haasn

This comment has been minimized.

Member

haasn commented Jan 6, 2017

Am I the only one for who this file gets detected as a JPEG?

That said, using dd if=pVG.jpg of=test.mp3 bs=1 skip=69812, the resulting file does play as an MP3 - although it's only 0.855 seconds in duration. What's more, it sounds like an actual song, and not garbled noise: https://0x0.st/fsH.mp3

@mpv-player mpv-player locked and limited conversation to collaborators Feb 15, 2017

@wm4

This comment has been minimized.

Contributor

wm4 commented Feb 15, 2017

I guess all this barely ontopic chatter is from "other" people from reddit.

So I deleted the chatter and locked the thread.

This is a bug tracker, not a forum.

@lachs0r

This comment has been minimized.

Member

lachs0r commented Jul 22, 2017

I blame file systems and broken HBAs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.